diff --git a/platform/src/lib.rs b/platform/src/lib.rs index 025733d745..df2e87b010 100644 --- a/platform/src/lib.rs +++ b/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; diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000..d52a68e960 --- /dev/null +++ b/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" diff --git a/src/ctype/build.rs b/src/ctype/build.rs index 089fee8df3..9b1ee3aecb 100644 --- a/src/ctype/build.rs +++ b/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"); } diff --git a/src/fcntl/build.rs b/src/fcntl/build.rs index b5f6c10ba6..fb1647837e 100644 --- a/src/fcntl/build.rs +++ b/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"); } diff --git a/src/fcntl/src/linux.rs b/src/fcntl/src/linux.rs index bf5b3b7487..fd68ffcf14 100644 --- a/src/fcntl/src/linux.rs +++ b/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; diff --git a/src/fcntl/src/redox.rs b/src/fcntl/src/redox.rs index 78a435869d..1ea3ca45de 100644 --- a/src/fcntl/src/redox.rs +++ b/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; diff --git a/src/grp/build.rs b/src/grp/build.rs index 9ee6c69617..196206d6c4 100644 --- a/src/grp/build.rs +++ b/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"); } diff --git a/src/mman/build.rs b/src/mman/build.rs index 0758d24db3..652a2ae435 100644 --- a/src/mman/build.rs +++ b/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"); } diff --git a/src/mman/src/lib.rs b/src/mman/src/lib.rs index e20b1269ff..ab4651126a 100644 --- a/src/mman/src/lib.rs +++ b/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!(); } diff --git a/src/semaphore/build.rs b/src/semaphore/build.rs index e24ff4d692..a5eba23b85 100644 --- a/src/semaphore/build.rs +++ b/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"); } diff --git a/src/semaphore/src/lib.rs b/src/semaphore/src/lib.rs index 676946c04c..e925561c93 100644 --- a/src/semaphore/src/lib.rs +++ b/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!(); } - diff --git a/src/stdio/build.rs b/src/stdio/build.rs index dc48bf16c5..1689fbc565 100644 --- a/src/stdio/build.rs +++ b/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"); } diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs index 529097c2fc..c25858a7a4 100644 --- a/src/stdio/src/lib.rs +++ b/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 { diff --git a/src/stdio/src/printf.rs b/src/stdio/src/printf.rs index 7dc2f53bbf..d1ce976cbd 100644 --- a/src/stdio/src/printf.rs +++ b/src/stdio/src/printf.rs @@ -24,68 +24,69 @@ pub unsafe fn printf(mut w: W, format: *const c_char, mut ap: VaL '%' => { w.write_char('%'); found_percent = false; - }, + } 'c' => { let a = ap.get::(); w.write_char(a as u8 as char); found_percent = false; - }, + } 'd' | 'i' => { let a = ap.get::(); w.write_fmt(format_args!("{}", a)); found_percent = false; - }, + } 'n' => { let _a = ap.get::(); found_percent = false; - }, + } 'p' => { let a = ap.get::(); w.write_fmt(format_args!("0x{:x}", a)); found_percent = false; - }, + } 's' => { let a = ap.get::(); - 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::(); w.write_fmt(format_args!("{}", a)); found_percent = false; - }, + } 'x' => { let a = ap.get::(); w.write_fmt(format_args!("{:x}", a)); found_percent = false; - }, + } 'X' => { let a = ap.get::(); w.write_fmt(format_args!("{:X}", a)); found_percent = false; - }, - '-' => {}, - '+' => {}, - ' ' => {}, - '#' => {}, - '0' ... '9' => {}, + } + '-' => {} + '+' => {} + ' ' => {} + '#' => {} + '0'...'9' => {} _ => {} } } else if b == b'%' { diff --git a/src/stdlib/build.rs b/src/stdlib/build.rs index 7a6ca43d98..44430ddae6 100644 --- a/src/stdlib/build.rs +++ b/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"); } diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs index 7d26f88b4c..da8d3e8ad5 100644 --- a/src/stdlib/src/lib.rs +++ b/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 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 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 c_int>) { +pub extern "C" fn qsort( + base: *mut c_void, + nel: size_t, + width: size_t, + compar: Option c_int>, +) { unimplemented!(); } diff --git a/src/string/build.rs b/src/string/build.rs index 8cfc6ee6c7..ce8ad27c5e 100644 --- a/src/string/build.rs +++ b/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"); } diff --git a/src/string/src/lib.rs b/src/string/src/lib.rs index e597532763..a12135ce3f 100644 --- a/src/string/src/lib.rs +++ b/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!(); } diff --git a/src/unistd/build.rs b/src/unistd/build.rs index 73e152d892..ca19204932 100644 --- a/src/unistd/build.rs +++ b/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"); } diff --git a/src/unistd/src/lib.rs b/src/unistd/src/lib.rs index b4ff1d9833..90811a6c7d 100644 --- a/src/unistd/src/lib.rs +++ b/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, parent: Option, child: Option) -> c_int { +pub extern "C" fn pthread_atfork( + prepare: Option, + parent: Option, + child: Option, +) -> 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!(); }