Browse Source

Get rustfmt passing on core relibc code

 - Add a rustfmt config
 - Get the current code passing the formatter
Dan Robertson 7 years ago
parent
commit
846e495944

+ 5 - 5
platform/src/lib.rs

@@ -3,18 +3,18 @@
 #![no_std]
 #![allow(non_camel_case_types)]
 
-#[cfg(all(not(feature="no_std"), target_os = "linux"))]
+#[cfg(all(not(feature = "no_std"), target_os = "linux"))]
 #[macro_use]
 extern crate sc;
 
 pub use sys::*;
 
-#[cfg(all(not(feature="no_std"), target_os = "linux"))]
-#[path="linux/mod.rs"]
+#[cfg(all(not(feature = "no_std"), target_os = "linux"))]
+#[path = "linux/mod.rs"]
 mod sys;
 
-#[cfg(all(not(feature="no_std"), target_os = "redox"))]
-#[path="redox/mod.rs"]
+#[cfg(all(not(feature = "no_std"), target_os = "redox"))]
+#[path = "redox/mod.rs"]
 mod sys;
 
 pub mod types;

+ 29 - 0
rustfmt.toml

@@ -0,0 +1,29 @@
+max_width = 100
+hard_tabs = false
+tab_spaces = 4
+newline_style = "Unix"
+indent_style = "Block"
+format_strings = false
+empty_item_single_line = true
+fn_single_line = false
+where_single_line = false
+imports_indent = "Visual"
+imports_layout = "Mixed"
+reorder_extern_crates = true
+reorder_extern_crates_in_group = true
+reorder_imports = false
+reorder_imported_names = true
+spaces_within_parens_and_brackets = false
+remove_blank_lines_at_start_or_end_of_block = true
+fn_args_density = "Tall"
+brace_style = "SameLineWhere"
+trailing_comma = "Vertical"
+blank_lines_upper_bound = 1
+blank_lines_lower_bound = 0
+force_explicit_abi = true
+write_mode = "Overwrite"
+disable_all_formatting = false
+skip_children = false
+hide_parse_errors = false
+report_todo = "Never"
+report_fixme = "Never"

+ 2 - 2
src/ctype/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/ctype.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/ctype.h");
 }

+ 2 - 2
src/fcntl/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/fcntl.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/fcntl.h");
 }

+ 5 - 5
src/fcntl/src/linux.rs

@@ -1,8 +1,8 @@
 use platform::types::*;
 
-pub const O_RDONLY: c_int =     0x0000;
-pub const O_WRONLY: c_int =     0x0001;
-pub const O_RDWR: c_int =       0x0002;
-pub const O_CREAT: c_int =      0x0040;
-pub const O_TRUNC: c_int =      0x0200;
+pub const O_RDONLY: c_int = 0x0000;
+pub const O_WRONLY: c_int = 0x0001;
+pub const O_RDWR: c_int = 0x0002;
+pub const O_CREAT: c_int = 0x0040;
+pub const O_TRUNC: c_int = 0x0200;
 pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR;

+ 17 - 17
src/fcntl/src/redox.rs

@@ -1,20 +1,20 @@
 use platform::types::*;
 
-pub const O_RDONLY: c_int =     0x0001_0000;
-pub const O_WRONLY: c_int =     0x0002_0000;
-pub const O_RDWR: c_int =       0x0003_0000;
-pub const O_NONBLOCK: c_int =   0x0004_0000;
-pub const O_APPEND: c_int =     0x0008_0000;
-pub const O_SHLOCK: c_int =     0x0010_0000;
-pub const O_EXLOCK: c_int =     0x0020_0000;
-pub const O_ASYNC: c_int =      0x0040_0000;
-pub const O_FSYNC: c_int =      0x0080_0000;
-pub const O_CLOEXEC: c_int =    0x0100_0000;
-pub const O_CREAT: c_int =      0x0200_0000;
-pub const O_TRUNC: c_int =      0x0400_0000;
-pub const O_EXCL: c_int =       0x0800_0000;
-pub const O_DIRECTORY: c_int =  0x1000_0000;
-pub const O_STAT: c_int =       0x2000_0000;
-pub const O_SYMLINK: c_int =    0x4000_0000;
-pub const O_NOFOLLOW: c_int =   0x8000_0000;
+pub const O_RDONLY: c_int = 0x0001_0000;
+pub const O_WRONLY: c_int = 0x0002_0000;
+pub const O_RDWR: c_int = 0x0003_0000;
+pub const O_NONBLOCK: c_int = 0x0004_0000;
+pub const O_APPEND: c_int = 0x0008_0000;
+pub const O_SHLOCK: c_int = 0x0010_0000;
+pub const O_EXLOCK: c_int = 0x0020_0000;
+pub const O_ASYNC: c_int = 0x0040_0000;
+pub const O_FSYNC: c_int = 0x0080_0000;
+pub const O_CLOEXEC: c_int = 0x0100_0000;
+pub const O_CREAT: c_int = 0x0200_0000;
+pub const O_TRUNC: c_int = 0x0400_0000;
+pub const O_EXCL: c_int = 0x0800_0000;
+pub const O_DIRECTORY: c_int = 0x1000_0000;
+pub const O_STAT: c_int = 0x2000_0000;
+pub const O_SYMLINK: c_int = 0x4000_0000;
+pub const O_NOFOLLOW: c_int = 0x8000_0000;
 pub const O_ACCMODE: c_int = O_RDONLY | O_WRONLY | O_RDWR;

+ 2 - 2
src/grp/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/grp.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/grp.h");
 }

+ 2 - 2
src/mman/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/mman.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/mman.h");
 }

+ 1 - 5
src/mman/src/lib.rs

@@ -52,11 +52,7 @@ pub extern "C" fn munmap(addr: *mut c_void, len: usize) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn shm_open(
-    name: *const c_char,
-    oflag: c_int,
-    mode: mode_t,
-) -> c_int {
+pub extern "C" fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
     unimplemented!();
 }
 

+ 2 - 2
src/semaphore/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/semaphore.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/semaphore.h");
 }

+ 6 - 8
src/semaphore/src/lib.rs

@@ -12,11 +12,12 @@ pub union sem_t {
     _bindgen_union_align: [u64; 4usize],
 }
 impl Clone for sem_t {
-    fn clone(&self) -> Self { *self }
+    fn clone(&self) -> Self {
+        *self
+    }
 }
 #[no_mangle]
-pub extern "C" fn sem_init(sem: *mut sem_t, pshared: c_int,
-                    value: c_uint) -> c_int {
+pub extern "C" fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int {
     unimplemented!();
 }
 
@@ -39,8 +40,7 @@ pub extern "C" fn sem_close(sem: *mut sem_t) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn sem_unlink(name: *const c_char)
-     -> c_int {
+pub extern "C" fn sem_unlink(name: *const c_char) -> c_int {
     unimplemented!();
 }
 
@@ -60,8 +60,6 @@ pub extern "C" fn sem_post(sem: *mut sem_t) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int)
-     -> c_int {
+pub extern "C" fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int {
     unimplemented!();
 }
-

+ 2 - 2
src/stdio/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/stdio.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/stdio.h");
 }

+ 37 - 65
src/stdio/src/lib.rs

@@ -30,14 +30,12 @@ pub extern "C" fn clearerr(stream: *mut FILE) {
 }
 
 #[no_mangle]
-pub extern "C" fn ctermid(s: *mut c_char)
-     -> *mut c_char {
+pub extern "C" fn ctermid(s: *mut c_char) -> *mut c_char {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn cuserid(s: *mut c_char)
-     -> *mut c_char {
+pub extern "C" fn cuserid(s: *mut c_char) -> *mut c_char {
     unimplemented!();
 }
 
@@ -47,8 +45,7 @@ pub extern "C" fn fclose(stream: *mut FILE) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn fdopen(fildes: c_int,
-                  mode: *const c_char) -> *mut FILE {
+pub extern "C" fn fdopen(fildes: c_int, mode: *const c_char) -> *mut FILE {
     unimplemented!();
 }
 
@@ -73,15 +70,12 @@ pub extern "C" fn fgetc(stream: *mut FILE) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn fgetpos(stream: *mut FILE, pos: *mut fpos_t)
-     -> c_int {
+pub extern "C" fn fgetpos(stream: *mut FILE, pos: *mut fpos_t) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fgets(s: *mut c_char,
-                 n: c_int, stream: *mut FILE)
-     -> *mut c_char {
+pub extern "C" fn fgets(s: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char {
     unimplemented!();
 }
 
@@ -96,51 +90,46 @@ pub extern "C" fn flockfile(file: *mut FILE) {
 }
 
 #[no_mangle]
-pub extern "C" fn fopen(filename: *const c_char,
-                 mode: *const c_char) -> *mut FILE {
+pub extern "C" fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fputc(c: c_int, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn fputc(c: c_int, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fputs(s: *const c_char, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn fputs(s: *const c_char, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fread(ptr: *mut c_void, size: usize, nitems: usize,
-                 stream: *mut FILE) -> usize {
+pub extern "C" fn fread(ptr: *mut c_void, size: usize, nitems: usize, stream: *mut FILE) -> usize {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn freopen(filename: *const c_char,
-                   mode: *const c_char, stream: *mut FILE)
-     -> *mut FILE {
+pub extern "C" fn freopen(
+    filename: *const c_char,
+    mode: *const c_char,
+    stream: *mut FILE,
+) -> *mut FILE {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fseek(stream: *mut FILE, offset: c_long,
-                 whence: c_int) -> c_int {
+pub extern "C" fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fseeko(stream: *mut FILE, offset: off_t, whence: c_int)
-     -> c_int {
+pub extern "C" fn fseeko(stream: *mut FILE, offset: off_t, whence: c_int) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn fsetpos(stream: *mut FILE, pos: *const fpos_t)
-     -> c_int {
+pub extern "C" fn fsetpos(stream: *mut FILE, pos: *const fpos_t) -> c_int {
     unimplemented!();
 }
 
@@ -165,8 +154,12 @@ pub extern "C" fn funlockfile(file: *mut FILE) {
 }
 
 #[no_mangle]
-pub extern "C" fn fwrite(ptr: *const c_void, size: usize,
-                  nitems: usize, stream: *mut FILE) -> usize {
+pub extern "C" fn fwrite(
+    ptr: *const c_void,
+    size: usize,
+    nitems: usize,
+    stream: *mut FILE,
+) -> usize {
     unimplemented!();
 }
 
@@ -191,8 +184,7 @@ pub extern "C" fn getchar_unlocked() -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn gets(s: *mut c_char)
-     -> *mut c_char {
+pub extern "C" fn gets(s: *mut c_char) -> *mut c_char {
     unimplemented!();
 }
 
@@ -212,14 +204,12 @@ pub extern "C" fn perror(s: *const c_char) {
 }
 
 #[no_mangle]
-pub extern "C" fn popen(command: *const c_char,
-                 mode: *const c_char) -> *mut FILE {
+pub extern "C" fn popen(command: *const c_char, mode: *const c_char) -> *mut FILE {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn putc(c: c_int, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn putc(c: c_int, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
@@ -229,14 +219,12 @@ pub extern "C" fn putchar(c: c_int) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn putc_unlocked(c: c_int, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn putc_unlocked(c: c_int, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn putchar_unlocked(c: c_int)
-     -> c_int {
+pub extern "C" fn putchar_unlocked(c: c_int) -> c_int {
     unimplemented!();
 }
 
@@ -246,21 +234,17 @@ pub extern "C" fn puts(s: *const c_char) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn putw(w: c_int, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn putw(w: c_int, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn remove(path: *const c_char)
-     -> c_int {
+pub extern "C" fn remove(path: *const c_char) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn rename(old: *const c_char,
-                  new: *const c_char)
-     -> c_int {
+pub extern "C" fn rename(old: *const c_char, new: *const c_char) -> c_int {
     unimplemented!();
 }
 
@@ -275,16 +259,12 @@ pub extern "C" fn setbuf(stream: *mut FILE, buf: *mut c_char) {
 }
 
 #[no_mangle]
-pub extern "C" fn setvbuf(stream: *mut FILE, buf: *mut c_char,
-                   mode: c_int, size: usize)
-     -> c_int {
+pub extern "C" fn setvbuf(stream: *mut FILE, buf: *mut c_char, mode: c_int, size: usize) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn tempnam(dir: *const c_char,
-                   pfx: *const c_char)
-     -> *mut c_char {
+pub extern "C" fn tempnam(dir: *const c_char, pfx: *const c_char) -> *mut c_char {
     unimplemented!();
 }
 
@@ -294,14 +274,12 @@ pub extern "C" fn tmpfile() -> *mut FILE {
 }
 
 #[no_mangle]
-pub extern "C" fn tmpnam(s: *mut c_char)
-     -> *mut c_char {
+pub extern "C" fn tmpnam(s: *mut c_char) -> *mut c_char {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn ungetc(c: c_int, stream: *mut FILE)
-     -> c_int {
+pub extern "C" fn ungetc(c: c_int, stream: *mut FILE) -> c_int {
     unimplemented!();
 }
 
@@ -316,21 +294,15 @@ pub unsafe extern "C" fn vprintf(format: *const c_char, ap: va_list) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn vsnprintf(s: *mut c_char, n: usize,
-                     format: *const c_char,
-                     ap: va_list) -> c_int {
+pub extern "C" fn vsnprintf(s: *mut c_char, n: usize, format: *const c_char, ap: va_list) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn vsprintf(s: *mut c_char,
-                    format: *const c_char,
-                    ap: va_list) -> c_int {
+pub extern "C" fn vsprintf(s: *mut c_char, format: *const c_char, ap: va_list) -> c_int {
     unimplemented!();
 }
 
-
-
 /*
 #[no_mangle]
 pub extern "C" fn func(args) -> c_int {

+ 18 - 17
src/stdio/src/printf.rs

@@ -24,68 +24,69 @@ pub unsafe fn printf<W: fmt::Write>(mut w: W, format: *const c_char, mut ap: VaL
                 '%' => {
                     w.write_char('%');
                     found_percent = false;
-                },
+                }
                 'c' => {
                     let a = ap.get::<u32>();
 
                     w.write_char(a as u8 as char);
 
                     found_percent = false;
-                },
+                }
                 'd' | 'i' => {
                     let a = ap.get::<c_int>();
 
                     w.write_fmt(format_args!("{}", a));
 
                     found_percent = false;
-                },
+                }
                 'n' => {
                     let _a = ap.get::<c_int>();
 
                     found_percent = false;
-                },
+                }
                 'p' => {
                     let a = ap.get::<usize>();
 
                     w.write_fmt(format_args!("0x{:x}", a));
 
                     found_percent = false;
-                },
+                }
                 's' => {
                     let a = ap.get::<usize>();
 
-                    w.write_str(str::from_utf8_unchecked(
-                        slice::from_raw_parts(a as *const u8, strlen(a as *const c_char))
-                    ));
+                    w.write_str(str::from_utf8_unchecked(slice::from_raw_parts(
+                        a as *const u8,
+                        strlen(a as *const c_char),
+                    )));
 
                     found_percent = false;
-                },
+                }
                 'u' => {
                     let a = ap.get::<c_uint>();
 
                     w.write_fmt(format_args!("{}", a));
 
                     found_percent = false;
-                },
+                }
                 'x' => {
                     let a = ap.get::<c_uint>();
 
                     w.write_fmt(format_args!("{:x}", a));
 
                     found_percent = false;
-                },
+                }
                 'X' => {
                     let a = ap.get::<c_uint>();
 
                     w.write_fmt(format_args!("{:X}", a));
 
                     found_percent = false;
-                },
-                '-' => {},
-                '+' => {},
-                ' ' => {},
-                '#' => {},
-                '0' ... '9' => {},
+                }
+                '-' => {}
+                '+' => {}
+                ' ' => {}
+                '#' => {}
+                '0'...'9' => {}
                 _ => {}
             }
         } else if b == b'%' {

+ 2 - 2
src/stdlib/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/stdlib.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/stdlib.h");
 }

+ 32 - 7
src/stdlib/src/lib.rs

@@ -66,7 +66,13 @@ pub extern "C" fn atol(s: *const c_char) -> c_long {
 }
 
 #[no_mangle]
-pub extern "C" fn bsearch(key: *const c_void, base: *const c_void, nel: size_t, width: size_t, compar: Option<extern "C" fn(*const c_void, *const c_void) -> c_int>) -> *mut c_void {
+pub extern "C" fn bsearch(
+    key: *const c_void,
+    base: *const c_void,
+    nel: size_t,
+    width: size_t,
+    compar: Option<extern "C" fn(*const c_void, *const c_void) -> c_int>,
+) -> *mut c_void {
     unimplemented!();
 }
 
@@ -92,7 +98,7 @@ pub struct div_t {
 pub extern "C" fn div(numer: c_int, denom: c_int) -> div_t {
     div_t {
         quot: numer / denom,
-        rem: numer % denom
+        rem: numer % denom,
     }
 }
 
@@ -102,7 +108,12 @@ pub extern "C" fn drand48() -> c_double {
 }
 
 #[no_mangle]
-pub extern "C" fn ecvt(value: c_double, ndigit: c_int, decpt: *mut c_int, sign: *mut c_int) -> *mut c_char {
+pub extern "C" fn ecvt(
+    value: c_double,
+    ndigit: c_int,
+    decpt: *mut c_int,
+    sign: *mut c_int,
+) -> *mut c_char {
     unimplemented!();
 }
 
@@ -125,7 +136,12 @@ pub unsafe extern "C" fn exit(status: c_int) {
 }
 
 #[no_mangle]
-pub extern "C" fn fcvt(value: c_double, ndigit: c_int, decpt: *mut c_int, sign: *mut c_int) -> *mut c_char {
+pub extern "C" fn fcvt(
+    value: c_double,
+    ndigit: c_int,
+    decpt: *mut c_int,
+    sign: *mut c_int,
+) -> *mut c_char {
     unimplemented!();
 }
 
@@ -148,7 +164,11 @@ pub extern "C" fn getenv(name: *const c_char) -> *mut c_char {
 }
 
 #[no_mangle]
-pub extern "C" fn getsubopt(optionp: *mut *mut c_char, tokens: *const *mut c_char, valuep: *mut *mut c_char) -> c_int {
+pub extern "C" fn getsubopt(
+    optionp: *mut *mut c_char,
+    tokens: *const *mut c_char,
+    valuep: *mut *mut c_char,
+) -> c_int {
     unimplemented!();
 }
 
@@ -196,7 +216,7 @@ pub struct ldiv_t {
 pub extern "C" fn ldiv(numer: c_long, denom: c_long) -> ldiv_t {
     ldiv_t {
         quot: numer / denom,
-        rem: numer % denom
+        rem: numer % denom,
     }
 }
 
@@ -264,7 +284,12 @@ pub extern "C" fn putenv(s: *mut c_char) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn qsort(base: *mut c_void, nel: size_t, width: size_t, compar: Option<extern "C" fn(*const c_void, *const c_void) -> c_int>) {
+pub extern "C" fn qsort(
+    base: *mut c_void,
+    nel: size_t,
+    width: size_t,
+    compar: Option<extern "C" fn(*const c_void, *const c_void) -> c_int>,
+) {
     unimplemented!();
 }
 

+ 2 - 2
src/string/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/string.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/string.h");
 }

+ 8 - 40
src/string/src/lib.rs

@@ -6,23 +6,13 @@ extern crate platform;
 
 use platform::types::*;
 
-
 #[no_mangle]
-pub extern "C" fn memccpy(
-    s1: *mut c_void,
-    s2: *const c_void,
-    c: c_int,
-    n: usize,
-) -> *mut c_void {
+pub extern "C" fn memccpy(s1: *mut c_void, s2: *const c_void, c: c_int, n: usize) -> *mut c_void {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn memchr(
-    s: *const c_void,
-    c: c_int,
-    n: usize,
-) -> *mut c_void {
+pub extern "C" fn memchr(s: *const c_void, c: c_int, n: usize) -> *mut c_void {
     unimplemented!();
 }
 
@@ -108,37 +98,22 @@ pub unsafe extern "C" fn strlen(s: *const c_char) -> size_t {
 }
 
 #[no_mangle]
-pub extern "C" fn strncat(
-    s1: *mut c_char,
-    s2: *const c_char,
-    n: usize,
-) -> *mut c_char {
+pub extern "C" fn strncat(s1: *mut c_char, s2: *const c_char, n: usize) -> *mut c_char {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn strncmp(
-    s1: *const c_char,
-    s2: *const c_char,
-    n: usize,
-) -> c_int {
+pub extern "C" fn strncmp(s1: *const c_char, s2: *const c_char, n: usize) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn strncpy(
-    s1: *mut c_char,
-    s2: *const c_char,
-    n: usize,
-) -> *mut c_char {
+pub extern "C" fn strncpy(s1: *mut c_char, s2: *const c_char, n: usize) -> *mut c_char {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn strpbrk(
-    s1: *const c_char,
-    s2: *const c_char,
-) -> *mut c_char {
+pub extern "C" fn strpbrk(s1: *const c_char, s2: *const c_char) -> *mut c_char {
     unimplemented!();
 }
 
@@ -153,10 +128,7 @@ pub extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong {
 }
 
 #[no_mangle]
-pub extern "C" fn strstr(
-    s1: *const c_char,
-    s2: *const c_char,
-) -> *mut c_char {
+pub extern "C" fn strstr(s1: *const c_char, s2: *const c_char) -> *mut c_char {
     unimplemented!();
 }
 
@@ -175,11 +147,7 @@ pub extern "C" fn strtok_r(
 }
 
 #[no_mangle]
-pub extern "C" fn strxfrm(
-    s1: *mut c_char,
-    s2: *const c_char,
-    n: usize,
-) -> c_ulong {
+pub extern "C" fn strxfrm(s1: *mut c_char, s2: *const c_char, n: usize) -> c_ulong {
     unimplemented!();
 }
 

+ 2 - 2
src/unistd/build.rs

@@ -6,6 +6,6 @@ fn main() {
     let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
     fs::create_dir_all("../../target/include").expect("failed to create include directory");
     cbindgen::generate(crate_dir)
-      .expect("failed to generate bindings")
-      .write_to_file("../../target/include/unistd.h");
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/unistd.h");
 }

+ 16 - 3
src/unistd/src/lib.rs

@@ -110,7 +110,11 @@ pub extern "C" fn execv(path: *const c_char, argv: *const *mut c_char) -> c_int
 }
 
 #[no_mangle]
-pub extern "C" fn execve(path: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int {
+pub extern "C" fn execve(
+    path: *const c_char,
+    argv: *const *mut c_char,
+    envp: *const *mut c_char,
+) -> c_int {
     unimplemented!();
 }
 
@@ -300,12 +304,21 @@ pub extern "C" fn pread(fildes: c_int, buf: *mut c_void, nbyte: size_t, offset:
 }
 
 #[no_mangle]
-pub extern "C" fn pthread_atfork(prepare: Option<extern "C" fn()>, parent: Option<extern "C" fn()>, child: Option<extern "C" fn()>) -> c_int {
+pub extern "C" fn pthread_atfork(
+    prepare: Option<extern "C" fn()>,
+    parent: Option<extern "C" fn()>,
+    child: Option<extern "C" fn()>,
+) -> c_int {
     unimplemented!();
 }
 
 #[no_mangle]
-pub extern "C" fn pwrite(fildes: c_int, buf: *const c_void, nbyte: size_t, offset: off_t) -> ssize_t {
+pub extern "C" fn pwrite(
+    fildes: c_int,
+    buf: *const c_void,
+    nbyte: size_t,
+    offset: off_t,
+) -> ssize_t {
     unimplemented!();
 }