From 024930f63cc14e0598f01e10e3fc9920c0fb66f3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 12 Jun 2019 09:43:50 +0200 Subject: [PATCH] cargo fmt --all Signed-off-by: Wolfgang Bumiller --- proxmox-sys/src/lib.rs | 1 - proxmox-sys/src/linux.rs | 5 ++--- proxmox/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/proxmox-sys/src/lib.rs b/proxmox-sys/src/lib.rs index 08b9341e..915abb2d 100644 --- a/proxmox-sys/src/lib.rs +++ b/proxmox-sys/src/lib.rs @@ -1,4 +1,3 @@ //! This is a system utility crate used by all our rust projects. - pub mod linux; diff --git a/proxmox-sys/src/linux.rs b/proxmox-sys/src/linux.rs index e1ca7416..4045457e 100644 --- a/proxmox-sys/src/linux.rs +++ b/proxmox-sys/src/linux.rs @@ -5,7 +5,6 @@ use proxmox_tools as tools; /// Get pseudo random data (/dev/urandom) pub fn random_data(size: usize) -> Result, Error> { - let mut buffer = tools::vec::undefined(size); fill_with_random_data(&mut buffer)?; @@ -16,7 +15,6 @@ pub fn random_data(size: usize) -> Result, Error> { /// /// This code uses the Linux syscall getrandom() - see "man 2 getrandom". pub fn fill_with_random_data(buffer: &mut [u8]) -> Result<(), Error> { - let res = unsafe { libc::syscall( libc::SYS_getrandom, @@ -30,7 +28,8 @@ pub fn fill_with_random_data(buffer: &mut [u8]) -> Result<(), Error> { return Err(std::io::Error::last_os_error().into()); } - if res as usize != buffer.len() { // should not happen + if res as usize != buffer.len() { + // should not happen bail!("short getrandom read"); } diff --git a/proxmox/src/lib.rs b/proxmox/src/lib.rs index 91244374..67005db2 100644 --- a/proxmox/src/lib.rs +++ b/proxmox/src/lib.rs @@ -1,5 +1,5 @@ -pub use proxmox_tools as tools; pub use proxmox_sys as sys; +pub use proxmox_tools as tools; // Both `proxmox_api` and the 2 macros from `proxmox_api_macro` should be // exposed via `proxmox::api`.