]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/hermit/mod.rs
Format libstd/sys with rustfmt
[rust.git] / src / libstd / sys / hermit / mod.rs
index d4359631769da2c0f093e7019fadbae1b26d1dcf..1e4a53abdc7bd9ed1cbc3ed27ed20e8f02218784 100644 (file)
 //! compiling for wasm. That way it's a compile time error for something that's
 //! guaranteed to be a runtime error!
 
-use crate::os::raw::c_char;
 use crate::intrinsics;
+use crate::os::raw::c_char;
 
 pub mod alloc;
 pub mod args;
-pub mod condvar;
-pub mod stdio;
-pub mod memchr;
-pub mod io;
-pub mod mutex;
-pub mod rwlock;
-pub mod os;
 pub mod cmath;
-pub mod thread;
+pub mod condvar;
 pub mod env;
-pub mod fs;
+pub mod fast_thread_local;
 pub mod fd;
+pub mod fs;
+pub mod io;
+pub mod memchr;
+pub mod mutex;
 pub mod net;
+pub mod os;
 pub mod path;
 pub mod pipe;
 pub mod process;
+pub mod rwlock;
 pub mod stack_overflow;
-pub mod time;
+pub mod stdio;
+pub mod thread;
 pub mod thread_local;
-pub mod fast_thread_local;
+pub mod time;
 
-pub use crate::sys_common::os_str_bytes as os_str;
 use crate::io::ErrorKind;
+pub use crate::sys_common::os_str_bytes as os_str;
 
 #[allow(unused_extern_crates)]
 pub extern crate hermit_abi as abi;
@@ -50,8 +50,7 @@ pub fn unsupported<T>() -> crate::io::Result<T> {
 }
 
 pub fn unsupported_err() -> crate::io::Error {
-    crate::io::Error::new(crate::io::ErrorKind::Other,
-           "operation not supported on HermitCore yet")
+    crate::io::Error::new(crate::io::ErrorKind::Other, "operation not supported on HermitCore yet")
 }
 
 // This enum is used as the storage for a bunch of types which can't actually
@@ -71,9 +70,7 @@ pub unsafe fn strlen(start: *const c_char) -> usize {
 
 #[no_mangle]
 pub extern "C" fn floor(x: f64) -> f64 {
-    unsafe {
-        intrinsics::floorf64(x)
-    }
+    unsafe { intrinsics::floorf64(x) }
 }
 
 pub unsafe fn abort_internal() -> ! {
@@ -103,8 +100,11 @@ pub fn init() {
 
 #[cfg(not(test))]
 #[no_mangle]
-pub unsafe extern "C" fn runtime_entry(argc: i32, argv: *const *const c_char,
-                                       env: *const *const c_char) -> ! {
+pub unsafe extern "C" fn runtime_entry(
+    argc: i32,
+    argv: *const *const c_char,
+    env: *const *const c_char,
+) -> ! {
     extern "C" {
         fn main(argc: isize, argv: *const *const c_char) -> i32;
     }
@@ -139,9 +139,5 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
 }
 
 pub fn cvt(result: i32) -> crate::io::Result<usize> {
-    if result < 0 {
-        Err(crate::io::Error::from_raw_os_error(-result))
-    } else {
-        Ok(result as usize)
-    }
+    if result < 0 { Err(crate::io::Error::from_raw_os_error(-result)) } else { Ok(result as usize) }
 }