From 74eca5e8715efded33e6964f7355be137a769b90 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Wed, 26 Feb 2020 12:23:21 -0800 Subject: [PATCH] fmt: Use consistent include style --- src/bsd_arandom.rs | 3 +-- src/error.rs | 3 +-- src/linux_android.rs | 8 +++++--- src/macos.rs | 7 +++++-- src/openbsd.rs | 3 +-- src/solaris_illumos.rs | 7 +++++-- src/use_file.rs | 14 +++++++++----- src/util_libc.rs | 6 ++---- src/vxworks.rs | 3 +-- 9 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/bsd_arandom.rs b/src/bsd_arandom.rs index 450dc0c..11a5db2 100644 --- a/src/bsd_arandom.rs +++ b/src/bsd_arandom.rs @@ -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 { diff --git a/src/error.rs b/src/error.rs index fd4dafe..b009383 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,8 +5,7 @@ // , 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. /// diff --git a/src/linux_android.rs b/src/linux_android.rs index a29feb5..5508fdd 100644 --- a/src/linux_android.rs +++ b/src/linux_android.rs @@ -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(); diff --git a/src/macos.rs b/src/macos.rs index 9201ec5..585a35a 100644 --- a/src/macos.rs +++ b/src/macos.rs @@ -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; diff --git a/src/openbsd.rs b/src/openbsd.rs index 6e2cf9a..c8d28b3 100644 --- a/src/openbsd.rs +++ b/src/openbsd.rs @@ -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) { diff --git a/src/solaris_illumos.rs b/src/solaris_illumos.rs index 9473123..2d1b767 100644 --- a/src/solaris_illumos.rs +++ b/src/solaris_illumos.rs @@ -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")] diff --git a/src/use_file.rs b/src/use_file.rs index f31fb03..465c069 100644 --- a/src/use_file.rs +++ b/src/use_file.rs @@ -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"; diff --git a/src/util_libc.rs b/src/util_libc.rs index d3a977a..d7c3f6c 100644 --- a/src/util_libc.rs +++ b/src/util_libc.rs @@ -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"))] { diff --git a/src/vxworks.rs b/src/vxworks.rs index 7911302..6cb5d52 100644 --- a/src/vxworks.rs +++ b/src/vxworks.rs @@ -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> {