Skip to content

Commit

Permalink
fmt: Use consistent include style
Browse files Browse the repository at this point in the history
  • Loading branch information
josephlr committed Feb 26, 2020
1 parent bc48252 commit ad2e813
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 26 deletions.
3 changes: 1 addition & 2 deletions custom/wasm-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
compile_error!("This crate is only for the `wasm32-unknown-unknown` target");

use core::cell::RefCell;
use core::mem;
use core::{cell::RefCell, mem};
use std::thread_local;

use wasm_bindgen::prelude::*;
Expand Down
3 changes: 1 addition & 2 deletions src/bsd_arandom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// except according to those terms.

//! Implementation for FreeBSD and NetBSD
use crate::util_libc::sys_fill_exact;
use crate::Error;
use crate::{util_libc::sys_fill_exact, Error};
use core::ptr;

fn kern_arnd(buf: &mut [u8]) -> libc::ssize_t {
Expand Down
3 changes: 1 addition & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::fmt;
use core::num::NonZeroU32;
use core::{fmt, num::NonZeroU32};

/// A small and `no_std` compatible error type.
///
Expand Down
8 changes: 5 additions & 3 deletions src/linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
// except according to those terms.

//! Implementation for Linux / Android
use crate::util::LazyBool;
use crate::util_libc::{last_os_error, sys_fill_exact};
use crate::{use_file, Error};
use crate::{
util::LazyBool,
util_libc::{last_os_error, sys_fill_exact},
{use_file, Error},
};

pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
static HAS_GETRANDOM: LazyBool = LazyBool::new();
Expand Down
7 changes: 5 additions & 2 deletions src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
// except according to those terms.

//! Implementation for macOS
use crate::util_libc::{last_os_error, Weak};
use crate::{use_file, Error};
use crate::{
use_file,
util_libc::{last_os_error, Weak},
Error,
};
use core::mem;

type GetEntropyFn = unsafe extern "C" fn(*mut u8, libc::size_t) -> libc::c_int;
Expand Down
3 changes: 1 addition & 2 deletions src/openbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// except according to those terms.

//! Implementation for OpenBSD
use crate::util_libc::last_os_error;
use crate::Error;
use crate::{util_libc::last_os_error, Error};

pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
for chunk in dest.chunks_mut(256) {
Expand Down
7 changes: 5 additions & 2 deletions src/solaris_illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
//! To make sure we can compile on both Solaris and its derivatives, as well as
//! function, we check for the existence of getrandom(2) in libc by calling
//! libc::dlsym.
use crate::util_libc::{sys_fill_exact, Weak};
use crate::{use_file, Error};
use crate::{
use_file,
util_libc::{sys_fill_exact, Weak},
Error,
};
use core::mem;

#[cfg(target_os = "illumos")]
Expand Down
14 changes: 9 additions & 5 deletions src/use_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
// except according to those terms.

//! Implementations that just need to read from a file
use crate::util::LazyUsize;
use crate::util_libc::{open_readonly, sys_fill_exact};
use crate::Error;
use core::cell::UnsafeCell;
use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use crate::{
util::LazyUsize,
util_libc::{open_readonly, sys_fill_exact},
Error,
};
use core::{
cell::UnsafeCell,
sync::atomic::{AtomicUsize, Ordering::Relaxed},
};

#[cfg(target_os = "redox")]
const FILE_PATH: &str = "rand:\0";
Expand Down
6 changes: 2 additions & 4 deletions src/util_libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
use crate::util::LazyUsize;
use crate::Error;
use core::num::NonZeroU32;
use core::ptr::NonNull;
use crate::{util::LazyUsize, Error};
use core::{num::NonZeroU32, ptr::NonNull};

cfg_if! {
if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
Expand Down
3 changes: 1 addition & 2 deletions src/vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// except according to those terms.

//! Implementation for VxWorks
use crate::util_libc::last_os_error;
use crate::Error;
use crate::{util_libc::last_os_error, Error};
use core::sync::atomic::{AtomicBool, Ordering::Relaxed};

pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
Expand Down

0 comments on commit ad2e813

Please sign in to comment.