From d0f6bcd3fc691d5f43f9b3d67bec446bc503fd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 15:39:17 +0200 Subject: [PATCH 01/15] features: core::ffi::c_void isn't really available before 1.30. --- src/features.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/features.rs b/src/features.rs index 57c5b2db1a..cbf761002b 100644 --- a/src/features.rs +++ b/src/features.rs @@ -168,10 +168,6 @@ macro_rules! rust_feature_def { } rust_feature_def!( - Stable_1_1 { - /// [c_void available in core](https://doc.rust-lang.org/core/ffi/enum.c_void.html) - => core_ffi_c_void; - } Stable_1_19 { /// Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md)) => untagged_union; @@ -204,6 +200,8 @@ rust_feature_def!( /// `const fn` support for limited cases /// ([PR](https://github.com/rust-lang/rust/pull/54835/) => min_const_fn; + /// [c_void available in core](https://doc.rust-lang.org/core/ffi/enum.c_void.html) + => core_ffi_c_void; } Stable_1_33 { /// repr(packed(N)) ([PR](https://github.com/rust-lang/rust/pull/57049)) @@ -242,7 +240,7 @@ mod test { ); let f_1_21 = RustFeatures::from(RustTarget::Stable_1_21); assert!( - f_1_21.core_ffi_c_void && + !f_1_21.core_ffi_c_void && f_1_21.untagged_union && f_1_21.associated_const && f_1_21.builtin_clone_impls && From ee89f4f08500a2ef20b3a489a884aaf4939b35d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 15:47:35 +0200 Subject: [PATCH 02/15] function: Fix #[must_use] support in libclang 9+. --- src/clang.rs | 33 ++++++++++++++++++++------------- src/ir/function.rs | 2 +- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/clang.rs b/src/clang.rs index 0a59c30976..efb5307425 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -527,25 +527,32 @@ impl Cursor { } } - /// Does this cursor have the given simple attribute? + /// Whether this cursor has the `warn_unused_result` attribute. + pub fn has_warn_unused_result_attr(&self) -> bool { + // FIXME(emilio): clang-sys doesn't expose this (from clang 9). + const CXCursor_WarnUnusedResultAttr: CXCursorKind = 440; + self.has_attr("warn_unused_result", Some(CXCursor_WarnUnusedResultAttr)) + } + + /// Does this cursor have the given attribute? /// - /// Note that this will only work for attributes that don't have an existing libclang - /// CursorKind, e.g. pure, const, etc. - pub fn has_simple_attr(&self, attr: &str) -> bool { + /// `name` is checked against unexposed attributes. + fn has_attr(&self, name: &str, clang_kind: Option) -> bool { let mut found_attr = false; self.visit(|cur| { - if cur.kind() == CXCursor_UnexposedAttr { - found_attr = cur.tokens().iter().any(|t| { + let kind = cur.kind(); + found_attr = clang_kind.map_or(false, |k| k == kind) || + (kind == CXCursor_UnexposedAttr && + cur.tokens().iter().any(|t| { t.kind == CXToken_Identifier && - t.spelling() == attr.as_bytes() - }); + t.spelling() == name.as_bytes() + })); - if found_attr { - return CXChildVisit_Break; - } + if found_attr { + CXChildVisit_Break + } else { + CXChildVisit_Continue } - - CXChildVisit_Continue }); found_attr diff --git a/src/ir/function.rs b/src/ir/function.rs index 9ccf4e14c2..0715ec546c 100644 --- a/src/ir/function.rs +++ b/src/ir/function.rs @@ -424,7 +424,7 @@ impl FunctionSig { }; let must_use = ctx.options().enable_function_attribute_detection && - cursor.has_simple_attr("warn_unused_result"); + cursor.has_warn_unused_result_attr(); let is_method = kind == CXCursor_CXXMethod; let is_constructor = kind == CXCursor_Constructor; let is_destructor = kind == CXCursor_Destructor; From 8efe3458673f6ea76ab74c0889934c1c3509fd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 14 Oct 2019 10:40:31 +0200 Subject: [PATCH 03/15] tests: Look at the more specific tests first, but don't require specific expectations for all llvm versions. --- tests/tests.rs | 55 ++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index 14729c80c0..f1656e2b0d 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -109,14 +109,13 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er expectation.pop(); expectation.push("expectations"); expectation.push("tests"); - expectation.push(file_name); - expectation.set_extension("rs"); - // If the expectation file doesn't exist, see if we have different test - // expectations for different libclang versions. - if !expectation.is_file() { - let file_name = expectation.file_name().unwrap().to_owned(); - expectation.pop(); + let mut looked_at = vec![]; + let mut expectation_file; + + // Try more specific expectations first. + { + let mut expectation = expectation.clone(); if cfg!(feature = "testing_only_libclang_4") { expectation.push("libclang-4"); @@ -144,17 +143,32 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er } expectation.push(file_name); + expectation.set_extension("rs"); + expectation_file = fs::File::open(&expectation).ok(); + looked_at.push(expectation); + } - if !expectation.is_file() { - panic!( - "missing test expectation file and/or 'testing_only_libclang_$VERSION' \ - feature for header '{}'; looking for expectation file at '{}'", - header.display(), - expectation.display() - ); - } + // Try the default path otherwise. + if expectation_file.is_none() { + expectation.push(file_name); + expectation.set_extension("rs"); + expectation_file = fs::File::open(&expectation).ok(); + looked_at.push(expectation); } + let mut expected = String::new(); + match expectation_file { + Some(f) => { + BufReader::new(f).read_to_string(&mut expected)?; + } + None => panic!( + "missing test expectation file and/or 'testing_only_libclang_$VERSION' \ + feature for header '{}'; looking for expectation file at '{:?}'", + header.display(), + looked_at, + ), + }; + // We skip the generate() error here so we get a full diff below let (actual, rustfmt_stderr) = match builder.generate() { Ok(bindings) => { @@ -165,13 +179,6 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er }; println!("{}", rustfmt_stderr); - let mut expected = String::new(); - { - if let Ok(expectation_file) = fs::File::open(&expectation) { - BufReader::new(expectation_file).read_to_string(&mut expected)?; - } - } - let (expected, rustfmt_stderr) = rustfmt(expected); println!("{}", rustfmt_stderr); @@ -188,7 +195,7 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er println!("{}", rustfmt_stderr); println!("diff expected generated"); - println!("--- expected: {:?}", expectation); + println!("--- expected: {:?}", looked_at.last().unwrap()); println!("+++ generated from: {:?}", header); for diff in diff::lines(&expected, &actual) { @@ -201,7 +208,7 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er // Overwrite the expectation with actual output. if env::var_os(OVERWRITE_ENV_VAR).is_some() { - let mut expectation_file = fs::File::create(&expectation)?; + let mut expectation_file = fs::File::create(looked_at.last().unwrap())?; expectation_file.write_all(actual.as_bytes())?; } From 1c4c0ab3f8668d08caf7f0d76167864707c64db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 14 Oct 2019 11:03:58 +0200 Subject: [PATCH 04/15] tests: Look at expectations/tests/libclang-9 expectations. --- tests/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/tests.rs b/tests/tests.rs index f1656e2b0d..6046cd8372 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -130,7 +130,9 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er None => {} Some(version) => { let (maj, min) = version; - let version_str = if maj >= 5 { + let version_str = if maj >= 9 { + "9".to_owned() + } else if maj >= 5 { "5".to_owned() } else if maj == 4 { "4".to_owned() From 2a91cff33e6c470033f6bb158dc16bf0501cd220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 15:56:05 +0200 Subject: [PATCH 05/15] Create clang-9-specific test directory, as a copy of clang-5. --- .../tests/libclang-9/abi_variadic_function.rs | 13 ++++ tests/expectations/tests/libclang-9/auto.rs | 34 ++++++++++ .../tests/libclang-9/call-conv-field.rs | 55 ++++++++++++++++ .../tests/libclang-9/const_bool.rs | 28 +++++++++ .../tests/libclang-9/constant-evaluate.rs | 27 ++++++++ ...0600-cannot-apply-unary-negation-to-u32.rs | 11 ++++ .../issue-769-bad-instantiation-test.rs | 40 ++++++++++++ .../tests/libclang-9/mangling-win32.rs | 51 +++++++++++++++ .../tests/libclang-9/objc_template.rs | 18 ++++++ .../partial-specialization-and-inheritance.rs | 38 +++++++++++ .../type_alias_template_specialized.rs | 63 +++++++++++++++++++ 11 files changed, 378 insertions(+) create mode 100644 tests/expectations/tests/libclang-9/abi_variadic_function.rs create mode 100644 tests/expectations/tests/libclang-9/auto.rs create mode 100644 tests/expectations/tests/libclang-9/call-conv-field.rs create mode 100644 tests/expectations/tests/libclang-9/const_bool.rs create mode 100644 tests/expectations/tests/libclang-9/constant-evaluate.rs create mode 100644 tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs create mode 100644 tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs create mode 100644 tests/expectations/tests/libclang-9/mangling-win32.rs create mode 100644 tests/expectations/tests/libclang-9/objc_template.rs create mode 100644 tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs create mode 100644 tests/expectations/tests/libclang-9/type_alias_template_specialized.rs diff --git a/tests/expectations/tests/libclang-9/abi_variadic_function.rs b/tests/expectations/tests/libclang-9/abi_variadic_function.rs new file mode 100644 index 0000000000..89cf9a64e9 --- /dev/null +++ b/tests/expectations/tests/libclang-9/abi_variadic_function.rs @@ -0,0 +1,13 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +extern "C" { + #[link_name = "\u{1}_Z1bcz"] + pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char; +} diff --git a/tests/expectations/tests/libclang-9/auto.rs b/tests/expectations/tests/libclang-9/auto.rs new file mode 100644 index 0000000000..2d7dfa3a85 --- /dev/null +++ b/tests/expectations/tests/libclang-9/auto.rs @@ -0,0 +1,34 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Foo { + pub _address: u8, +} +pub const Foo_kFoo: bool = true; +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(Foo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(Foo)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Bar { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}_Z5Test2v"] + pub fn Test2() -> ::std::os::raw::c_uint; +} diff --git a/tests/expectations/tests/libclang-9/call-conv-field.rs b/tests/expectations/tests/libclang-9/call-conv-field.rs new file mode 100644 index 0000000000..3286ac4668 --- /dev/null +++ b/tests/expectations/tests/libclang-9/call-conv-field.rs @@ -0,0 +1,55 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![cfg(not(test))] + +#[repr(C)] +#[derive(Default, Copy, Clone)] +pub struct JNINativeInterface_ { + pub GetVersion: ::std::option::Option< + unsafe extern "stdcall" fn(env: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, + >, + pub __bindgen_padding_0: u32, + pub __hack: ::std::os::raw::c_ulonglong, +} +#[test] +fn bindgen_test_layout_JNINativeInterface_() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(JNINativeInterface_)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeInterface_)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetVersion as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface_), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__hack as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface_), + "::", + stringify!(__hack) + ) + ); +} +extern "stdcall" { + pub fn bar(); +} diff --git a/tests/expectations/tests/libclang-9/const_bool.rs b/tests/expectations/tests/libclang-9/const_bool.rs new file mode 100644 index 0000000000..14f5139400 --- /dev/null +++ b/tests/expectations/tests/libclang-9/const_bool.rs @@ -0,0 +1,28 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +pub const k: bool = true; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct A { + pub _address: u8, +} +pub const A_k: bool = false; +#[test] +fn bindgen_test_layout_A() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(A)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(A)) + ); +} +pub type foo = bool; +pub const k2: foo = true; diff --git a/tests/expectations/tests/libclang-9/constant-evaluate.rs b/tests/expectations/tests/libclang-9/constant-evaluate.rs new file mode 100644 index 0000000000..07df8114df --- /dev/null +++ b/tests/expectations/tests/libclang-9/constant-evaluate.rs @@ -0,0 +1,27 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo; +pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum _bindgen_ty_1 { + foo = 4, + bar = 8, +} +pub type EasyToOverflow = ::std::os::raw::c_ulonglong; +pub const k: EasyToOverflow = 2147483648; +pub const k_expr: EasyToOverflow = 1152921504606846976; +pub const wow: EasyToOverflow = 2147483648; +pub const BAZ: ::std::os::raw::c_longlong = 24; +pub const fuzz: f64 = 51.0; +pub const BAZZ: ::std::os::raw::c_char = 53; +pub const WAT: ::std::os::raw::c_char = 0; +pub const bytestring: &'static [u8; 4usize] = b"Foo\0"; +pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8]; diff --git a/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs b/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs new file mode 100644 index 0000000000..ce5d0362d6 --- /dev/null +++ b/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs @@ -0,0 +1,11 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![allow(overflowing_literals)] + +pub const a: u32 = 4294967291; diff --git a/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs new file mode 100644 index 0000000000..86fad78d46 --- /dev/null +++ b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs @@ -0,0 +1,40 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] +pub mod root { + #[allow(unused_imports)] + use self::super::root; + #[repr(C)] + #[derive(Debug, Copy, Clone)] + pub struct Rooted { + pub member: T, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + } + impl Default for Rooted { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } + } + pub type AutoValueVector_Alias = ::std::os::raw::c_int; + #[test] + fn __bindgen_test_layout_Rooted_open0_int_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 4usize, + concat!( + "Size of template specialization: ", + stringify ! ( root :: Rooted < :: std :: os :: raw :: c_int > ) + ) + ); + assert_eq ! ( :: std :: mem :: align_of :: < root :: Rooted < :: std :: os :: raw :: c_int > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( root :: Rooted < :: std :: os :: raw :: c_int > ) ) ); + } + #[test] + fn __bindgen_test_layout_Rooted_open0_AutoValueVector_Alias_close0_instantiation() { + assert_eq ! ( :: std :: mem :: size_of :: < root :: Rooted < root :: AutoValueVector_Alias > > ( ) , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( root :: Rooted < root :: AutoValueVector_Alias > ) ) ); + assert_eq ! ( :: std :: mem :: align_of :: < root :: Rooted < root :: AutoValueVector_Alias > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( root :: Rooted < root :: AutoValueVector_Alias > ) ) ); + } +} diff --git a/tests/expectations/tests/libclang-9/mangling-win32.rs b/tests/expectations/tests/libclang-9/mangling-win32.rs new file mode 100644 index 0000000000..ad4ac42a15 --- /dev/null +++ b/tests/expectations/tests/libclang-9/mangling-win32.rs @@ -0,0 +1,51 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +extern "C" { + pub fn foo(); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Foo { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}?sBar@Foo@@2_NA"] + pub static mut Foo_sBar: bool; +} +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(Foo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(Foo)) + ); +} +extern "fastcall" { + pub fn fast_call_func_no_args() -> ::std::os::raw::c_int; +} +extern "fastcall" { + pub fn fast_call_func_many_args( + arg1: ::std::os::raw::c_int, + arg2: ::std::os::raw::c_int, + arg3: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "stdcall" { + pub fn std_call_func_no_args() -> ::std::os::raw::c_int; +} +extern "stdcall" { + pub fn std_call_func_many_args( + arg1: ::std::os::raw::c_int, + arg2: ::std::os::raw::c_int, + arg3: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} diff --git a/tests/expectations/tests/libclang-9/objc_template.rs b/tests/expectations/tests/libclang-9/objc_template.rs new file mode 100644 index 0000000000..06a9a55f40 --- /dev/null +++ b/tests/expectations/tests/libclang-9/objc_template.rs @@ -0,0 +1,18 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +#![cfg(target_os="macos")] + +#[macro_use] +extern crate objc; +#[allow(non_camel_case_types)] +pub type id = *mut objc::runtime::Object; +pub trait Foo { + unsafe fn get(self) + -> *mut ObjectType; +} +impl Foo for id { + unsafe fn get(self) -> *mut ObjectType { msg_send!(self , get) } +} diff --git a/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs new file mode 100644 index 0000000000..97d2eabe41 --- /dev/null +++ b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs @@ -0,0 +1,38 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Base { + pub _address: u8, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Derived { + pub b: bool, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Usage { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}_ZN5Usage13static_memberE"] + pub static mut Usage_static_member: [u32; 2usize]; +} +#[test] +fn bindgen_test_layout_Usage() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(Usage)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(Usage)) + ); +} diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs new file mode 100644 index 0000000000..89e37fe81e --- /dev/null +++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs @@ -0,0 +1,63 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct Rooted { + pub ptr: MaybeWrapped<::std::os::raw::c_int>, +} +#[test] +fn bindgen_test_layout_Rooted() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(Rooted)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(Rooted)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ptr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(Rooted), + "::", + stringify!(ptr) + ) + ); +} +impl Default for Rooted { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +///
+pub type MaybeWrapped
= a; +#[test] +fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 4usize, + concat!( + "Size of template specialization: ", + stringify!(MaybeWrapped<::std::os::raw::c_int>) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 4usize, + concat!( + "Alignment of template specialization: ", + stringify!(MaybeWrapped<::std::os::raw::c_int>) + ) + ); +} From 34cf236b896d4c13e9e9052a3ec4a12a6ca1ce08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:07:36 +0200 Subject: [PATCH 06/15] Update test expectations for libclang 9.0. --- tests/expectations/tests/libclang-9/class.rs | 636 ++++++++++++++++ .../tests/libclang-9/class_1_0.rs | 694 ++++++++++++++++++ ...erive-hash-struct-with-incomplete-array.rs | 158 ++++ .../libclang-9/incomplete-array-padding.rs | 178 +++++ .../libclang-9/issue-643-inner-struct.rs | 172 +++++ .../tests/libclang-9/layout_align.rs | 297 ++++++++ .../tests/libclang-9/objc_template.rs | 18 +- .../tests/libclang-9/zero-sized-array.rs | 183 +++++ 8 files changed, 2329 insertions(+), 7 deletions(-) create mode 100644 tests/expectations/tests/libclang-9/class.rs create mode 100644 tests/expectations/tests/libclang-9/class_1_0.rs create mode 100644 tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs create mode 100644 tests/expectations/tests/libclang-9/incomplete-array-padding.rs create mode 100644 tests/expectations/tests/libclang-9/issue-643-inner-struct.rs create mode 100644 tests/expectations/tests/libclang-9/layout_align.rs create mode 100644 tests/expectations/tests/libclang-9/zero-sized-array.rs diff --git a/tests/expectations/tests/libclang-9/class.rs b/tests/expectations/tests/libclang-9/class.rs new file mode 100644 index 0000000000..285c108b54 --- /dev/null +++ b/tests/expectations/tests/libclang-9/class.rs @@ -0,0 +1,636 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct C { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], +} +#[test] +fn bindgen_test_layout_C() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).big_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C), + "::", + stringify!(big_array) + ) + ); +} +impl Default for C { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +pub struct C_with_zero_length_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C_with_zero_length_array)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_zero_length_array)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zero_length_array as *const _ + as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(zero_length_array) + ) + ); +} +impl Default for C_with_zero_length_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_zero_length_array_2 { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(C_with_zero_length_array_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zero_length_array as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_2), + "::", + stringify!(zero_length_array) + ) + ); +} +#[repr(C)] +pub struct C_with_incomplete_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_incomplete_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C_with_incomplete_array)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_incomplete_array)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for C_with_incomplete_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_incomplete_array_2 { + pub a: ::std::os::raw::c_int, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_incomplete_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(C_with_incomplete_array_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_incomplete_array_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array_2), + "::", + stringify!(incomplete_array) + ) + ); +} +#[repr(C)] +pub struct C_with_zero_length_array_and_incomplete_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!( + "Size of: ", + stringify!(C_with_zero_length_array_and_incomplete_array) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(C_with_zero_length_array_and_incomplete_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(zero_length_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .incomplete_array as *const _ as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for C_with_zero_length_array_and_incomplete_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_zero_length_array_and_incomplete_array_2 { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(C_with_zero_length_array_and_incomplete_array_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).a + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(zero_length_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .incomplete_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(incomplete_array) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct WithDtor { + pub b: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_WithDtor() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(WithDtor)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(WithDtor)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(WithDtor), + "::", + stringify!(b) + ) + ); +} +#[repr(C)] +pub struct IncompleteArrayNonCopiable { + pub whatever: *mut ::std::os::raw::c_void, + pub incomplete_array: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_IncompleteArrayNonCopiable() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(IncompleteArrayNonCopiable)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).whatever as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(IncompleteArrayNonCopiable), + "::", + stringify!(whatever) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(IncompleteArrayNonCopiable), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for IncompleteArrayNonCopiable { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Union { + pub d: f32, + pub i: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +#[test] +fn bindgen_test_layout_Union() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(Union)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(Union)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) + ); +} +impl Default for Union { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct WithUnion { + pub data: Union, +} +#[test] +fn bindgen_test_layout_WithUnion() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(WithUnion)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(WithUnion)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(WithUnion), + "::", + stringify!(data) + ) + ); +} +impl Default for WithUnion { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +pub struct RealAbstractionWithTonsOfMethods { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(RealAbstractionWithTonsOfMethods)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(RealAbstractionWithTonsOfMethods) + ) + ); +} +extern "C" { + #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] + pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] + pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] + pub fn RealAbstractionWithTonsOfMethods_bar2( + this: *mut RealAbstractionWithTonsOfMethods, + foo: ::std::os::raw::c_int, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"] + pub fn RealAbstractionWithTonsOfMethods_sta(); +} +impl RealAbstractionWithTonsOfMethods { + #[inline] + pub unsafe fn bar(&self) { + RealAbstractionWithTonsOfMethods_bar(self) + } + #[inline] + pub unsafe fn bar1(&mut self) { + RealAbstractionWithTonsOfMethods_bar1(self) + } + #[inline] + pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) { + RealAbstractionWithTonsOfMethods_bar2(self, foo) + } + #[inline] + pub unsafe fn sta() { + RealAbstractionWithTonsOfMethods_sta() + } +} diff --git a/tests/expectations/tests/libclang-9/class_1_0.rs b/tests/expectations/tests/libclang-9/class_1_0.rs new file mode 100644 index 0000000000..b331dcdfa7 --- /dev/null +++ b/tests/expectations/tests/libclang-9/class_1_0.rs @@ -0,0 +1,694 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +pub struct __BindgenUnionField(::std::marker::PhantomData); +impl __BindgenUnionField { + #[inline] + pub fn new() -> Self { + __BindgenUnionField(::std::marker::PhantomData) + } + #[inline] + pub unsafe fn as_ref(&self) -> &T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut(&mut self) -> &mut T { + ::std::mem::transmute(self) + } +} +impl ::std::default::Default for __BindgenUnionField { + #[inline] + fn default() -> Self { + Self::new() + } +} +impl ::std::clone::Clone for __BindgenUnionField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +impl ::std::marker::Copy for __BindgenUnionField {} +impl ::std::fmt::Debug for __BindgenUnionField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__BindgenUnionField") + } +} +impl ::std::hash::Hash for __BindgenUnionField { + fn hash(&self, _state: &mut H) {} +} +impl ::std::cmp::PartialEq for __BindgenUnionField { + fn eq(&self, _other: &__BindgenUnionField) -> bool { + true + } +} +impl ::std::cmp::Eq for __BindgenUnionField {} +#[repr(C)] +#[derive(Copy)] +pub struct C { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], +} +#[test] +fn bindgen_test_layout_C() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).big_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C), + "::", + stringify!(big_array) + ) + ); +} +impl Clone for C { + fn clone(&self) -> Self { + *self + } +} +impl Default for C { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +impl ::std::cmp::PartialEq for C { + fn eq(&self, other: &C) -> bool { + self.a == other.a && &self.big_array[..] == &other.big_array[..] + } +} +#[repr(C)] +pub struct C_with_zero_length_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C_with_zero_length_array)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_zero_length_array)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zero_length_array as *const _ + as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array), + "::", + stringify!(zero_length_array) + ) + ); +} +impl Default for C_with_zero_length_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_zero_length_array_2 { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(C_with_zero_length_array_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zero_length_array as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_2), + "::", + stringify!(zero_length_array) + ) + ); +} +#[repr(C)] +pub struct C_with_incomplete_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_incomplete_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(C_with_incomplete_array)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_incomplete_array)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for C_with_incomplete_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_incomplete_array_2 { + pub a: ::std::os::raw::c_int, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_incomplete_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(C_with_incomplete_array_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(C_with_incomplete_array_2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_incomplete_array_2), + "::", + stringify!(incomplete_array) + ) + ); +} +#[repr(C)] +pub struct C_with_zero_length_array_and_incomplete_array { + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!( + "Size of: ", + stringify!(C_with_zero_length_array_and_incomplete_array) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(C_with_zero_length_array_and_incomplete_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).big_array + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(big_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(zero_length_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .incomplete_array as *const _ as usize + }, + 37usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for C_with_zero_length_array_and_incomplete_array { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct C_with_zero_length_array_and_incomplete_array_2 { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(C_with_zero_length_array_and_incomplete_array_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).a + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(a) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(zero_length_array) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .incomplete_array as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(C_with_zero_length_array_and_incomplete_array_2), + "::", + stringify!(incomplete_array) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Hash, PartialEq, Eq)] +pub struct WithDtor { + pub b: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_WithDtor() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(WithDtor)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(WithDtor)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(WithDtor), + "::", + stringify!(b) + ) + ); +} +#[repr(C)] +pub struct IncompleteArrayNonCopiable { + pub whatever: *mut ::std::os::raw::c_void, + pub incomplete_array: __IncompleteArrayField, +} +#[test] +fn bindgen_test_layout_IncompleteArrayNonCopiable() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(IncompleteArrayNonCopiable)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).whatever as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(IncompleteArrayNonCopiable), + "::", + stringify!(whatever) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).incomplete_array as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(IncompleteArrayNonCopiable), + "::", + stringify!(incomplete_array) + ) + ); +} +impl Default for IncompleteArrayNonCopiable { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] +pub struct Union { + pub d: __BindgenUnionField, + pub i: __BindgenUnionField<::std::os::raw::c_int>, + pub bindgen_union_field: u32, +} +#[test] +fn bindgen_test_layout_Union() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(Union)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(Union)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) + ); +} +impl Clone for Union { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] +pub struct WithUnion { + pub data: Union, +} +#[test] +fn bindgen_test_layout_WithUnion() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(WithUnion)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(WithUnion)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(WithUnion), + "::", + stringify!(data) + ) + ); +} +impl Clone for WithUnion { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] +pub struct RealAbstractionWithTonsOfMethods { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(RealAbstractionWithTonsOfMethods)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(RealAbstractionWithTonsOfMethods) + ) + ); +} +extern "C" { + #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] + pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] + pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] + pub fn RealAbstractionWithTonsOfMethods_bar2( + this: *mut RealAbstractionWithTonsOfMethods, + foo: ::std::os::raw::c_int, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"] + pub fn RealAbstractionWithTonsOfMethods_sta(); +} +impl Clone for RealAbstractionWithTonsOfMethods { + fn clone(&self) -> Self { + *self + } +} +impl RealAbstractionWithTonsOfMethods { + #[inline] + pub unsafe fn bar(&self) { + RealAbstractionWithTonsOfMethods_bar(self) + } + #[inline] + pub unsafe fn bar1(&mut self) { + RealAbstractionWithTonsOfMethods_bar1(self) + } + #[inline] + pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) { + RealAbstractionWithTonsOfMethods_bar2(self, foo) + } + #[inline] + pub unsafe fn sta() { + RealAbstractionWithTonsOfMethods_sta() + } +} diff --git a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs new file mode 100644 index 0000000000..0e0516dcf1 --- /dev/null +++ b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs @@ -0,0 +1,158 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct test { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_test() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(test)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(test)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(test), "::", stringify!(a)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).zero_length_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(test), + "::", + stringify!(zero_length_array) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct test2 { + pub a: ::std::os::raw::c_int, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_test2() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(test2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(test2)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(test2), "::", stringify!(a)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).incomplete_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(test2), + "::", + stringify!(incomplete_array) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default)] +pub struct test3 { + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_test3() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(test3)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(test3)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(test3), "::", stringify!(a)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).zero_length_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(test3), + "::", + stringify!(zero_length_array) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).incomplete_array as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(test3), + "::", + stringify!(incomplete_array) + ) + ); +} diff --git a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs new file mode 100644 index 0000000000..d089eaf6ad --- /dev/null +++ b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs @@ -0,0 +1,178 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit { + #[inline] + pub const fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +#[derive(Debug)] +pub struct foo { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, + pub b: __IncompleteArrayField<*mut ::std::os::raw::c_void>, +} +#[test] +fn bindgen_test_layout_foo() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(foo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(foo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 8usize, + concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) + ); +} +impl Default for foo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +impl foo { + #[inline] + pub fn a(&self) -> ::std::os::raw::c_char { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + } + #[inline] + pub fn set_a(&mut self, val: ::std::os::raw::c_char) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1(a: ::std::os::raw::c_char) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let a: u8 = unsafe { ::std::mem::transmute(a) }; + a as u64 + }); + __bindgen_bitfield_unit + } +} diff --git a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs new file mode 100644 index 0000000000..85c4c0d910 --- /dev/null +++ b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs @@ -0,0 +1,172 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +#[derive(Debug)] +pub struct rte_ring { + pub memzone: *mut rte_memzone, + pub prod: rte_ring_prod, + pub cons: rte_ring_cons, + pub ring: __IncompleteArrayField<*mut ::std::os::raw::c_void>, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct rte_ring_prod { + pub watermark: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_rte_ring_prod() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(rte_ring_prod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(rte_ring_prod)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).watermark as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rte_ring_prod), + "::", + stringify!(watermark) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct rte_ring_cons { + pub sc_dequeue: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_rte_ring_cons() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(rte_ring_cons)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(rte_ring_cons)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sc_dequeue as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rte_ring_cons), + "::", + stringify!(sc_dequeue) + ) + ); +} +#[test] +fn bindgen_test_layout_rte_ring() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(rte_ring)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rte_ring)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).memzone as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rte_ring), + "::", + stringify!(memzone) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).prod as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(rte_ring), + "::", + stringify!(prod) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cons as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(rte_ring), + "::", + stringify!(cons) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ring as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rte_ring), + "::", + stringify!(ring) + ) + ); +} +impl Default for rte_ring { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct rte_memzone { + pub _address: u8, +} diff --git a/tests/expectations/tests/libclang-9/layout_align.rs b/tests/expectations/tests/libclang-9/layout_align.rs new file mode 100644 index 0000000000..be4df10ea5 --- /dev/null +++ b/tests/expectations/tests/libclang-9/layout_align.rs @@ -0,0 +1,297 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit { + #[inline] + pub const fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +#[repr(C)] +#[derive(Debug)] +pub struct rte_kni_fifo { + ///< Next position to be written + pub write: ::std::os::raw::c_uint, + ///< Next position to be read + pub read: ::std::os::raw::c_uint, + ///< Circular buffer length + pub len: ::std::os::raw::c_uint, + ///< Pointer size - for 32/64 bit OS + pub elem_size: ::std::os::raw::c_uint, + ///< The buffer contains mbuf pointers + pub buffer: __IncompleteArrayField<*mut ::std::os::raw::c_void>, +} +#[test] +fn bindgen_test_layout_rte_kni_fifo() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(rte_kni_fifo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rte_kni_fifo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).write as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rte_kni_fifo), + "::", + stringify!(write) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).read as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(rte_kni_fifo), + "::", + stringify!(read) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(rte_kni_fifo), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).elem_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(rte_kni_fifo), + "::", + stringify!(elem_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).buffer as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rte_kni_fifo), + "::", + stringify!(buffer) + ) + ); +} +impl Default for rte_kni_fifo { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[repr(C)] +#[repr(align(8))] +#[derive(Debug, Default, Copy, Clone)] +pub struct rte_eth_link { + ///< ETH_SPEED_NUM_ + pub link_speed: u32, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, + pub __bindgen_padding_0: [u8; 3usize], +} +#[test] +fn bindgen_test_layout_rte_eth_link() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(rte_eth_link)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rte_eth_link)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).link_speed as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rte_eth_link), + "::", + stringify!(link_speed) + ) + ); +} +impl rte_eth_link { + #[inline] + pub fn link_duplex(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + } + #[inline] + pub fn set_link_duplex(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn link_autoneg(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + } + #[inline] + pub fn set_link_autoneg(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn link_status(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + } + #[inline] + pub fn set_link_status(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + link_duplex: u16, + link_autoneg: u16, + link_status: u16, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let link_duplex: u16 = unsafe { ::std::mem::transmute(link_duplex) }; + link_duplex as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let link_autoneg: u16 = unsafe { ::std::mem::transmute(link_autoneg) }; + link_autoneg as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let link_status: u16 = unsafe { ::std::mem::transmute(link_status) }; + link_status as u64 + }); + __bindgen_bitfield_unit + } +} diff --git a/tests/expectations/tests/libclang-9/objc_template.rs b/tests/expectations/tests/libclang-9/objc_template.rs index 06a9a55f40..84eef1ef60 100644 --- a/tests/expectations/tests/libclang-9/objc_template.rs +++ b/tests/expectations/tests/libclang-9/objc_template.rs @@ -1,18 +1,22 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - -#![cfg(target_os="macos")] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![cfg(target_os = "macos")] #[macro_use] extern crate objc; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; pub trait Foo { - unsafe fn get(self) - -> *mut ObjectType; + unsafe fn get(self) -> u64; } impl Foo for id { - unsafe fn get(self) -> *mut ObjectType { msg_send!(self , get) } + unsafe fn get(self) -> u64 { + msg_send!(self, get) + } } diff --git a/tests/expectations/tests/libclang-9/zero-sized-array.rs b/tests/expectations/tests/libclang-9/zero-sized-array.rs new file mode 100644 index 0000000000..41dc5c4f21 --- /dev/null +++ b/tests/expectations/tests/libclang-9/zero-sized-array.rs @@ -0,0 +1,183 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub unsafe fn as_ptr(&self) -> *const T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { + ::std::mem::transmute(self) + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +impl ::std::clone::Clone for __IncompleteArrayField { + #[inline] + fn clone(&self) -> Self { + Self::new() + } +} +/// Bizarrely enough, this should *not* get an `_address` field. +#[repr(C)] +#[derive(Debug, Default)] +pub struct ZeroSizedArray { + pub arr: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_ZeroSizedArray() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(ZeroSizedArray)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(ZeroSizedArray)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ZeroSizedArray), + "::", + stringify!(arr) + ) + ); +} +/// And nor should this get an `_address` field. +#[repr(C)] +#[derive(Debug, Default)] +pub struct ContainsZeroSizedArray { + pub zsa: ZeroSizedArray, +} +#[test] +fn bindgen_test_layout_ContainsZeroSizedArray() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(ContainsZeroSizedArray)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(ContainsZeroSizedArray)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).zsa as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ContainsZeroSizedArray), + "::", + stringify!(zsa) + ) + ); +} +/// Inheriting from ZeroSizedArray shouldn't cause an `_address` to be inserted +/// either. +#[repr(C)] +#[derive(Debug, Default)] +pub struct InheritsZeroSizedArray { + pub _base: ZeroSizedArray, +} +#[test] +fn bindgen_test_layout_InheritsZeroSizedArray() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(InheritsZeroSizedArray)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(InheritsZeroSizedArray)) + ); +} +/// And this should not get an `_address` field either. +#[repr(C)] +#[derive(Debug, Default)] +pub struct DynamicallySizedArray { + pub arr: __IncompleteArrayField<::std::os::raw::c_char>, +} +#[test] +fn bindgen_test_layout_DynamicallySizedArray() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(DynamicallySizedArray)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(DynamicallySizedArray)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(DynamicallySizedArray), + "::", + stringify!(arr) + ) + ); +} +/// No `_address` field here either. +#[repr(C)] +#[derive(Debug, Default)] +pub struct ContainsDynamicallySizedArray { + pub dsa: DynamicallySizedArray, +} +#[test] +fn bindgen_test_layout_ContainsDynamicallySizedArray() { + assert_eq!( + ::std::mem::size_of::(), + 0usize, + concat!("Size of: ", stringify!(ContainsDynamicallySizedArray)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(ContainsDynamicallySizedArray)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dsa as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ContainsDynamicallySizedArray), + "::", + stringify!(dsa) + ) + ); +} From 9a8f407e22bd368dd1d5f268a1effee06f2546f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 15:55:00 +0200 Subject: [PATCH 07/15] Add llvm 9.0 to CI. --- .travis.yml | 20 +++++++++++++------- Cargo.toml | 1 + appveyor.yml | 8 +++++++- bindgen-integration/Cargo.toml | 1 + ci/before_install.sh | 2 ++ src/main.rs | 25 +++++++++++++------------ tests/expectations/build.rs | 2 +- tests/stylo_sanity.rs | 4 +++- tests/tests.rs | 8 +++++--- 9 files changed, 46 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36e10e1a91..58302008cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,21 +30,27 @@ env: - LLVM_VERSION="4.0" BINDGEN_JOB="nofeatures" BINDGEN_PROFILE="--release" - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE= - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" - - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions" - - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="testing_only_extra_assertions" - LLVM_VERSION="5.0" BINDGEN_JOB="integration" BINDGEN_PROFILE= - LLVM_VERSION="5.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release" - LLVM_VERSION="5.0" BINDGEN_JOB="nofeatures" BINDGEN_PROFILE= - LLVM_VERSION="5.0" BINDGEN_JOB="nofeatures" BINDGEN_PROFILE="--release" - - LLVM_VERSION="5.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE= - - LLVM_VERSION="5.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release" - - LLVM_VERSION="5.0" BINDGEN_JOB="misc" - - LLVM_VERSION="5.0" BINDGEN_JOB="quickchecking" + - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= + - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" + - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions" + - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="testing_only_extra_assertions" + - LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE= + - LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release" + - LLVM_VERSION="9.0" BINDGEN_JOB="nofeatures" BINDGEN_PROFILE= + - LLVM_VERSION="9.0" BINDGEN_JOB="nofeatures" BINDGEN_PROFILE="--release" + - LLVM_VERSION="9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE= + - LLVM_VERSION="9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release" + - LLVM_VERSION="9.0" BINDGEN_JOB="misc" + - LLVM_VERSION="9.0" BINDGEN_JOB="quickchecking" matrix: fast_finish: true allow_failures: - - env: LLVM_VERSION=5.0 BINDGEN_JOB=rustfmt + - env: LLVM_VERSION=9.0 BINDGEN_JOB=rustfmt cache: directories: diff --git a/Cargo.toml b/Cargo.toml index 9a71b27724..c71f65b0a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,6 +81,7 @@ which-rustfmt = ["which"] # on bindgen! testing_only_docs = [] testing_only_extra_assertions = [] +testing_only_libclang_9 = [] testing_only_libclang_5 = [] testing_only_libclang_4 = [] testing_only_libclang_3_9 = [] diff --git a/appveyor.yml b/appveyor.yml index 91009f68f6..342f47cc2e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,9 +8,12 @@ environment: - TARGET: gnu LLVM_VERSION: 4.0.0-1 BINDGEN_FEATURES: testing_only_libclang_4 - - TARGET: msvc + - TARGET: gnu LLVM_VERSION: 5.0.0-1 BINDGEN_FEATURES: testing_only_libclang_5 + - TARGET: gnu + LLVM_VERSION: 9.0.0-1 + BINDGEN_FEATURES: testing_only_libclang_9 - TARGET: msvc LLVM_VERSION: 3.9.0 BINDGEN_FEATURES: testing_only_libclang_3_9 @@ -20,6 +23,9 @@ environment: - TARGET: msvc LLVM_VERSION: 5.0.0 BINDGEN_FEATURES: testing_only_libclang_5 + - TARGET: msvc + LLVM_VERSION: 9.0.0 + BINDGEN_FEATURES: testing_only_libclang_9 configuration: - stable diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml index 1cd69b9fcc..8f0cb1f94f 100644 --- a/bindgen-integration/Cargo.toml +++ b/bindgen-integration/Cargo.toml @@ -11,6 +11,7 @@ bindgen = { path = ".." } cc = "1.0" [features] +testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"] testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"] testing_only_libclang_4 = ["bindgen/testing_only_libclang_4"] testing_only_libclang_3_9 = ["bindgen/testing_only_libclang_3_9"] diff --git a/ci/before_install.sh b/ci/before_install.sh index fcc00ea2cc..41b397716b 100644 --- a/ci/before_install.sh +++ b/ci/before_install.sh @@ -29,6 +29,8 @@ function llvm_version_triple() { echo "4.0.0" elif [ "$1" == "5.0" ]; then echo "5.0.0" + elif [ "$1" == "9.0" ]; then + echo "9.0.0" fi } diff --git a/src/main.rs b/src/main.rs index 5e22b1e6bc..2c32d3cbef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,23 +24,24 @@ pub fn main() { let bind_args: Vec<_> = env::args().collect(); let version = clang_version(); - let expected_version = if cfg!(feature = "testing_only_libclang_4") { - (4, 0) + let expected_version = if cfg!(feature = "testing_only_libclang_9") { + Some((9, 0)) + } else if cfg!(feature = "testing_only_libclang_5") { + Some((5, 0)) + } else if cfg!(feature = "testing_only_libclang_4") { + Some((4, 0)) + } else if cfg!(feature = "testing_only_libclang_3_9") { + Some((3, 9)) } else if cfg!(feature = "testing_only_libclang_3_8") { - (3, 8) + Some((3, 8)) } else { - // Default to 3.9. - (3, 9) + None }; - info!("Clang Version: {}", version.full); + info!("Clang Version: {}, parsed: {:?}", version.full, version.parsed); - match version.parsed { - None => warn!("Couldn't parse libclang version"), - Some(version) if version != expected_version => { - warn!("Using clang {:?}, expected {:?}", version, expected_version); - } - _ => {} + if expected_version.is_some() { + assert_eq!(version.parsed, version.parsed); } match builder_from_flags(bind_args.into_iter()) { diff --git a/tests/expectations/build.rs b/tests/expectations/build.rs index 4f5e5a5ee6..0aae10dee8 100644 --- a/tests/expectations/build.rs +++ b/tests/expectations/build.rs @@ -9,7 +9,7 @@ use std::io::Write; use std::path::Path; const LIBCLANG_VERSION_DIRS: &'static [&'static str] = - &["libclang-3.8", "libclang-3.9", "libclang-4", "libclang-5"]; + &["libclang-3.8", "libclang-3.9", "libclang-4", "libclang-5", "libclang-9"]; fn main() { println!("cargo:rerun-if-changed=build.rs"); diff --git a/tests/stylo_sanity.rs b/tests/stylo_sanity.rs index 41d614a829..54fbb64e1e 100755 --- a/tests/stylo_sanity.rs +++ b/tests/stylo_sanity.rs @@ -21,7 +21,9 @@ extern crate bindgen; )))] #[cfg(any( feature = "testing_only_libclang_3_9", - feature = "testing_only_libclang_4" + feature = "testing_only_libclang_4", + feature = "testing_only_libclang_5", + feature = "testing_only_libclang_9" ))] fn sanity_check_can_generate_stylo_bindings() { use std::time::Instant; diff --git a/tests/tests.rs b/tests/tests.rs index 6046cd8372..f0fc9ff6c1 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -117,10 +117,12 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er { let mut expectation = expectation.clone(); - if cfg!(feature = "testing_only_libclang_4") { - expectation.push("libclang-4"); + if cfg!(feature = "testing_only_libclang_9") { + expectation.push("libclang-9"); } else if cfg!(feature = "testing_only_libclang_5") { expectation.push("libclang-5"); + } else if cfg!(feature = "testing_only_libclang_4") { + expectation.push("libclang-4"); } else if cfg!(feature = "testing_only_libclang_3_9") { expectation.push("libclang-3.9"); } else if cfg!(feature = "testing_only_libclang_3_8") { @@ -134,7 +136,7 @@ fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Er "9".to_owned() } else if maj >= 5 { "5".to_owned() - } else if maj == 4 { + } else if maj >= 4 { "4".to_owned() } else { format!("{}.{}", maj, min) From d0012f9f0bcec6730c05a62ef162fe9a9933cb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:13:12 +0200 Subject: [PATCH 08/15] tests: Fix some warning in the test crate. --- tests/expectations/build.rs | 2 +- tests/tests.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/expectations/build.rs b/tests/expectations/build.rs index 0aae10dee8..4e83fc26c1 100644 --- a/tests/expectations/build.rs +++ b/tests/expectations/build.rs @@ -37,7 +37,7 @@ fn main() { .to_string() .chars() .map(|c| match c { - 'a'...'z' | 'A'...'Z' | '0'...'9' => c, + 'a'..='z' | 'A'..='Z' | '0'..='9' => c, _ => '_', }) .collect(); diff --git a/tests/tests.rs b/tests/tests.rs index f0fc9ff6c1..a6c8f4a0ff 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -11,7 +11,7 @@ use std::fs; use std::io::{self, BufRead, BufReader, Error, ErrorKind, Read, Write}; use std::path::PathBuf; use std::process; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; #[path = "../src/options.rs"] mod options; @@ -23,7 +23,7 @@ static OVERWRITE_ENV_VAR: &str = "BINDGEN_OVERWRITE_EXPECTED"; // Run `rustfmt` on the given source string and return a tuple of the formatted // bindings, and rustfmt's stderr. fn rustfmt(source: String) -> (String, String) { - static CHECK_RUSTFMT: Once = ONCE_INIT; + static CHECK_RUSTFMT: Once = Once::new(); CHECK_RUSTFMT.call_once(|| { let have_working_rustfmt = process::Command::new("rustup") From 5aec0a99a070d4fe5486e942fbad6f3644661055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:15:24 +0200 Subject: [PATCH 09/15] tests: Use the same rustfmt configuration as the parent directory. This allows us to workaround/fix https://github.com/rust-lang/rustfmt/issues/3799 --- tests/rustfmt.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/rustfmt.toml b/tests/rustfmt.toml index e8bb3d9a05..2564ccb5d7 100644 --- a/tests/rustfmt.toml +++ b/tests/rustfmt.toml @@ -1 +1,3 @@ normalize_doc_attributes = true +max_width = 80 +binop_separator = "back" From 95c4017eb4052495fdda768f58e8c5b06286a5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:23:25 +0200 Subject: [PATCH 10/15] tests: Reformat test crate. Now that the rustfmt configuration is different we need to do this to not generate unexpected failures. --- tests/expectations/build.rs | 16 +- tests/expectations/src/lib.rs | 1 + tests/expectations/tests/16-byte-alignment.rs | 54 ++- .../tests/16-byte-alignment_1_0.rs | 69 ++- .../expectations/tests/381-decltype-alias.rs | 9 +- tests/expectations/tests/accessors.rs | 70 ++- tests/expectations/tests/annotation_hide.rs | 4 +- tests/expectations/tests/anon_enum.rs | 7 +- tests/expectations/tests/anon_enum_trait.rs | 15 +- .../expectations/tests/anon_enum_whitelist.rs | 7 +- .../tests/anon_struct_in_union.rs | 10 +- .../tests/anon_struct_in_union_1_0.rs | 19 +- tests/expectations/tests/anon_union.rs | 3 +- tests/expectations/tests/anon_union_1_0.rs | 10 +- .../tests/anonymous-template-types.rs | 9 +- tests/expectations/tests/arg_keyword.rs | 9 +- .../tests/array-of-zero-sized-types.rs | 5 +- .../tests/attribute_warn_unused_result.rs | 10 +- ...rn_unused_result_no_attribute_detection.rs | 10 +- .../attribute_warn_unused_result_pre_1_27.rs | 10 +- .../bad-namespace-parenthood-inheritance.rs | 9 +- tests/expectations/tests/base-to-derived.rs | 9 +- .../tests/bindgen-union-inside-namespace.rs | 27 +- .../tests/bitfield-32bit-overflow.rs | 148 ++++-- tests/expectations/tests/bitfield-large.rs | 43 +- .../tests/bitfield-method-same-name.rs | 20 +- tests/expectations/tests/bitfield_align.rs | 154 ++++-- tests/expectations/tests/bitfield_align_2.rs | 24 +- .../tests/bitfield_method_mangling.rs | 24 +- .../tests/blacklist-and-impl-debug.rs | 5 +- tests/expectations/tests/block_return_type.rs | 6 +- tests/expectations/tests/blocks-signature.rs | 24 +- tests/expectations/tests/blocks.rs | 15 +- tests/expectations/tests/builtin-template.rs | 9 +- tests/expectations/tests/c-empty-layout.rs | 9 +- tests/expectations/tests/call-conv-typedef.rs | 5 +- .../canonical_path_without_namespacing.rs | 9 +- tests/expectations/tests/char.rs | 9 +- tests/expectations/tests/class.rs | 39 +- tests/expectations/tests/class_1_0.rs | 39 +- tests/expectations/tests/class_nested.rs | 13 +- tests/expectations/tests/class_no_members.rs | 12 +- tests/expectations/tests/class_static.rs | 12 +- .../expectations/tests/class_static_const.rs | 9 +- tests/expectations/tests/class_use_as.rs | 5 +- tests/expectations/tests/class_with_dtor.rs | 14 +- .../tests/class_with_inner_struct.rs | 60 ++- .../tests/class_with_inner_struct_1_0.rs | 67 ++- .../expectations/tests/class_with_typedef.rs | 9 +- tests/expectations/tests/comment-indent.rs | 4 +- tests/expectations/tests/complex.rs | 27 +- tests/expectations/tests/complex_global.rs | 9 +- .../expectations/tests/const-const-mut-ptr.rs | 7 +- .../expectations/tests/const_array_fn_arg.rs | 9 +- .../expectations/tests/const_enum_unnamed.rs | 7 +- tests/expectations/tests/const_ptr.rs | 9 +- tests/expectations/tests/const_resolved_ty.rs | 9 +- tests/expectations/tests/const_tparam.rs | 7 +- .../tests/constant-non-specialized-tp.rs | 9 +- .../expectations/tests/constify-all-enums.rs | 12 +- tests/expectations/tests/constify-enum.rs | 6 +- .../tests/constify-module-enums-basic.rs | 12 +- .../tests/constify-module-enums-namespace.rs | 10 +- .../constify-module-enums-shadow-name.rs | 7 +- .../constify-module-enums-simple-alias.rs | 23 +- ...onstify-module-enums-simple-nonamespace.rs | 7 +- .../tests/constify-module-enums-types.rs | 17 +- tests/expectations/tests/constructor-tp.rs | 9 +- tests/expectations/tests/constructors.rs | 14 +- .../tests/contains-vs-inherits-zero-sized.rs | 4 +- .../tests/convert-cpp-comment-to-rust.rs | 12 +- tests/expectations/tests/convert-floats.rs | 8 +- tests/expectations/tests/cpp-empty-layout.rs | 9 +- tests/expectations/tests/crtp.rs | 9 +- tests/expectations/tests/dash_language.rs | 9 +- .../tests/decl_extern_int_twice.rs | 9 +- tests/expectations/tests/decl_ptr_to_array.rs | 9 +- .../tests/default-template-parameter.rs | 9 +- .../tests/derive-bitfield-method-same-name.rs | 30 +- tests/expectations/tests/derive-clone.rs | 5 +- tests/expectations/tests/derive-clone_1_0.rs | 5 +- .../tests/derive-debug-bitfield-core.rs | 33 +- .../tests/derive-debug-bitfield.rs | 39 +- .../tests/derive-debug-function-pointer.rs | 26 +- .../tests/derive-debug-generic.rs | 9 +- .../tests/derive-debug-mangle-name.rs | 19 +- ...ive-debug-opaque-template-instantiation.rs | 13 +- .../expectations/tests/derive-debug-opaque.rs | 4 +- .../tests/derive-default-and-blacklist.rs | 5 +- tests/expectations/tests/derive-fn-ptr.rs | 8 +- .../tests/derive-hash-and-blacklist.rs | 5 +- .../tests/derive-hash-blacklisting.rs | 8 +- ...rive-hash-struct-with-anon-struct-float.rs | 8 +- ...erive-hash-struct-with-incomplete-array.rs | 5 +- .../tests/derive-hash-struct-with-pointer.rs | 17 +- .../tests/derive-partialeq-and-blacklist.rs | 5 +- .../tests/derive-partialeq-base.rs | 9 +- .../tests/derive-partialeq-bitfield.rs | 39 +- .../tests/derive-partialeq-core.rs | 12 +- .../tests/derive-partialeq-union.rs | 10 +- .../tests/derive-partialeq-union_1_0.rs | 10 +- .../expectations/tests/disable-namespacing.rs | 9 +- .../tests/divide-by-zero-in-struct-layout.rs | 28 +- .../expectations/tests/do-not-derive-copy.rs | 12 +- .../duplicated-namespaces-definitions.rs | 42 +- .../tests/duplicated-namespaces.rs | 9 +- .../tests/duplicated_constants_in_ns.rs | 9 +- tests/expectations/tests/elaborated.rs | 9 +- tests/expectations/tests/empty-enum.rs | 7 +- .../tests/empty_template_param_name.rs | 9 +- .../expectations/tests/enum-default-consts.rs | 7 +- .../expectations/tests/enum-default-module.rs | 7 +- tests/expectations/tests/enum-default-rust.rs | 7 +- tests/expectations/tests/enum-undefault.rs | 7 +- tests/expectations/tests/enum_alias.rs | 7 +- .../tests/enum_and_vtable_mangling.rs | 7 +- .../expectations/tests/enum_explicit_type.rs | 7 +- .../tests/enum_explicit_type_constants.rs | 7 +- tests/expectations/tests/enum_negative.rs | 7 +- tests/expectations/tests/enum_packed.rs | 7 +- .../tests/eval-variadic-template-parameter.rs | 9 +- .../expectations/tests/extern-const-struct.rs | 4 +- tests/expectations/tests/extern.rs | 12 +- tests/expectations/tests/float128.rs | 8 +- .../tests/forward-declaration-autoptr.rs | 11 +- tests/expectations/tests/forward-enum-decl.rs | 7 +- .../forward-inherit-struct-with-fields.rs | 9 +- .../tests/forward-inherit-struct.rs | 9 +- .../tests/forward_declared_complex_types.rs | 7 +- .../tests/forward_declared_struct.rs | 9 +- tests/expectations/tests/func_proto.rs | 12 +- tests/expectations/tests/func_ptr.rs | 18 +- .../expectations/tests/func_ptr_in_struct.rs | 5 +- .../tests/func_ptr_return_type.rs | 1 - .../expectations/tests/func_with_array_arg.rs | 9 +- .../tests/func_with_func_ptr_arg.rs | 10 +- .../tests/gen-constructors-neg.rs | 9 +- tests/expectations/tests/gen-constructors.rs | 9 +- .../expectations/tests/gen-destructors-neg.rs | 9 +- tests/expectations/tests/gen-destructors.rs | 9 +- tests/expectations/tests/generate-inline.rs | 9 +- tests/expectations/tests/i128.rs | 8 +- tests/expectations/tests/in_class_typedef.rs | 9 +- .../tests/incomplete-array-padding.rs | 24 +- tests/expectations/tests/infinite-macro.rs | 9 +- ...from-template-instantiation-with-vtable.rs | 15 +- .../expectations/tests/inherit-namespaced.rs | 9 +- tests/expectations/tests/inherit_named.rs | 9 +- tests/expectations/tests/inherit_typedef.rs | 9 +- tests/expectations/tests/inline-function.rs | 8 +- tests/expectations/tests/inline_namespace.rs | 16 +- .../tests/inline_namespace_conservative.rs | 16 +- .../tests/inline_namespace_no_ns_enabled.rs | 9 +- .../tests/inline_namespace_whitelist.rs | 9 +- tests/expectations/tests/inner_const.rs | 9 +- .../expectations/tests/inner_template_self.rs | 14 +- tests/expectations/tests/int128_t.rs | 8 +- .../tests/issue-1025-unknown-enum-repr.rs | 9 +- tests/expectations/tests/issue-1034.rs | 16 +- tests/expectations/tests/issue-1040.rs | 9 +- .../issue-1076-unnamed-bitfield-alignment.rs | 16 +- .../tests/issue-1113-template-references.rs | 9 +- .../tests/issue-1118-using-forward-decl.rs | 20 +- .../tests/issue-1197-pure-virtual-stuff.rs | 7 +- ...1198-alias-rust-const-mod-bitfield-enum.rs | 7 +- .../issue-1198-alias-rust-const-mod-enum.rs | 7 +- .../tests/issue-1238-fwd-no-copy.rs | 7 +- tests/expectations/tests/issue-1281.rs | 7 +- tests/expectations/tests/issue-1285.rs | 8 +- tests/expectations/tests/issue-1291.rs | 28 +- tests/expectations/tests/issue-1498.rs | 35 +- tests/expectations/tests/issue-1554.rs | 1 - tests/expectations/tests/issue-358.rs | 9 +- tests/expectations/tests/issue-372.rs | 7 +- tests/expectations/tests/issue-410.rs | 7 +- tests/expectations/tests/issue-446.rs | 9 +- tests/expectations/tests/issue-447.rs | 13 +- .../tests/issue-537-repr-packed-n.rs | 24 +- tests/expectations/tests/issue-537.rs | 24 +- .../tests/issue-544-stylo-creduce-2.rs | 9 +- .../tests/issue-544-stylo-creduce.rs | 9 +- ...ate-params-causing-layout-test-failures.rs | 7 +- .../tests/issue-573-layout-test-failures.rs | 13 +- .../issue-574-assertion-failure-in-codegen.rs | 13 +- ...issue-584-stylo-template-analysis-panic.rs | 8 +- ...e-638-stylo-cannot-find-T-in-this-scope.rs | 9 +- .../tests/issue-639-typedef-anon-field.rs | 9 +- .../tests/issue-643-inner-struct.rs | 10 +- ...ue-645-cannot-find-type-T-in-this-scope.rs | 8 +- .../issue-648-derive-debug-with-padding.rs | 10 +- .../tests/issue-654-struct-fn-collision.rs | 7 +- .../issue-662-cannot-find-T-in-this-scope.rs | 9 +- tests/expectations/tests/issue-662-part-2.rs | 8 +- tests/expectations/tests/issue-674-1.rs | 14 +- tests/expectations/tests/issue-674-2.rs | 9 +- tests/expectations/tests/issue-674-3.rs | 13 +- .../tests/issue-677-nested-ns-specifier.rs | 9 +- .../issue-691-template-parameter-virtual.rs | 9 +- .../tests/issue-739-pointer-wide-bitfield.rs | 32 +- ...07-opaque-types-methods-being-generated.rs | 5 +- tests/expectations/tests/issue-816.rs | 180 +++++-- ...ssue-820-unused-template-param-in-alias.rs | 9 +- ...26-generating-methods-when-asked-not-to.rs | 9 +- tests/expectations/tests/issue-833-1.rs | 8 +- tests/expectations/tests/issue-833-2.rs | 8 +- tests/expectations/tests/issue-833.rs | 8 +- tests/expectations/tests/issue-834.rs | 9 +- .../tests/issue-888-enum-var-decl-jump.rs | 7 +- .../issue-944-derive-copy-and-blacklisting.rs | 4 +- tests/expectations/tests/issue-946.rs | 7 +- tests/expectations/tests/issue_311.rs | 9 +- .../expectations/tests/jsval_layout_opaque.rs | 70 ++- .../tests/jsval_layout_opaque_1_0.rs | 70 ++- tests/expectations/tests/keywords.rs | 9 +- tests/expectations/tests/layout_align.rs | 42 +- tests/expectations/tests/layout_arp.rs | 45 +- tests/expectations/tests/layout_array.rs | 105 +++-- .../tests/layout_array_too_long.rs | 63 ++- .../tests/layout_cmdline_token.rs | 45 +- tests/expectations/tests/layout_eth_conf.rs | 445 +++++++++++++----- .../expectations/tests/layout_eth_conf_1_0.rs | 445 +++++++++++++----- tests/expectations/tests/layout_kni_mbuf.rs | 63 ++- .../tests/layout_large_align_field.rs | 142 ++++-- tests/expectations/tests/layout_mbuf.rs | 296 +++++++----- tests/expectations/tests/layout_mbuf_1_0.rs | 308 +++++++----- ...bclang_version_specific_generated_tests.rs | 5 +- tests/expectations/tests/macro-expr-basic.rs | 7 +- .../tests/macro-expr-uncommon-token.rs | 7 +- tests/expectations/tests/macro-redef.rs | 7 +- .../tests/maddness-is-avoidable.rs | 9 +- tests/expectations/tests/mangling-ios.rs | 9 +- tests/expectations/tests/mangling-linux32.rs | 9 +- tests/expectations/tests/mangling-linux64.rs | 9 +- tests/expectations/tests/mangling-macos.rs | 9 +- tests/expectations/tests/mangling-win64.rs | 9 +- tests/expectations/tests/method-mangling.rs | 9 +- .../expectations/tests/module-whitelisted.rs | 9 +- tests/expectations/tests/msvc-no-usr.rs | 9 +- .../multiple-inherit-empty-correct-layout.rs | 9 +- tests/expectations/tests/mutable.rs | 18 +- tests/expectations/tests/namespace.rs | 10 +- tests/expectations/tests/nested.rs | 17 +- tests/expectations/tests/nested_vtable.rs | 13 +- .../tests/nested_within_namespace.rs | 35 +- tests/expectations/tests/no-comments.rs | 9 +- .../expectations/tests/no-hash-whitelisted.rs | 9 +- .../tests/no-partialeq-whitelisted.rs | 13 +- tests/expectations/tests/no-std.rs | 8 +- .../expectations/tests/no_copy_whitelisted.rs | 9 +- tests/expectations/tests/non-type-params.rs | 24 +- tests/expectations/tests/nsBaseHashtable.rs | 9 +- tests/expectations/tests/nsStyleAutoArray.rs | 7 +- tests/expectations/tests/objc_category.rs | 8 +- tests/expectations/tests/objc_class.rs | 8 +- tests/expectations/tests/objc_class_method.rs | 7 +- tests/expectations/tests/objc_interface.rs | 8 +- .../expectations/tests/objc_interface_type.rs | 12 +- tests/expectations/tests/objc_method.rs | 8 +- tests/expectations/tests/objc_method_clash.rs | 7 +- .../expectations/tests/objc_property_fnptr.rs | 8 +- tests/expectations/tests/objc_protocol.rs | 8 +- tests/expectations/tests/objc_sel_and_id.rs | 8 +- tests/expectations/tests/objc_whitelist.rs | 13 +- tests/expectations/tests/only_bitfields.rs | 29 +- .../tests/opaque-template-inst-member-2.rs | 15 +- .../tests/opaque-template-inst-member.rs | 15 +- ...paque-template-instantiation-namespaced.rs | 53 ++- .../tests/opaque-template-instantiation.rs | 15 +- tests/expectations/tests/opaque_in_struct.rs | 4 +- tests/expectations/tests/opaque_pointer.rs | 13 +- tests/expectations/tests/overflowed_enum.rs | 7 +- tests/expectations/tests/overloading.rs | 14 +- tests/expectations/tests/prepend_enum_name.rs | 7 +- tests/expectations/tests/private.rs | 30 +- tests/expectations/tests/public-dtor.rs | 9 +- tests/expectations/tests/redeclaration.rs | 9 +- .../expectations/tests/ref_argument_array.rs | 7 +- .../tests/reparented_replacement.rs | 11 +- .../tests/resolved_type_def_function.rs | 9 +- ...ame_struct_name_in_different_namespaces.rs | 15 +- .../tests/sentry-defined-multiple-times.rs | 92 ++-- tests/expectations/tests/short-enums.rs | 7 +- tests/expectations/tests/size_t_template.rs | 9 +- ...ruct_containing_forward_declared_struct.rs | 9 +- tests/expectations/tests/struct_typedef.rs | 17 +- tests/expectations/tests/struct_typedef_ns.rs | 21 +- .../tests/struct_with_anon_struct.rs | 17 +- .../tests/struct_with_anon_struct_array.rs | 25 +- .../tests/struct_with_anon_struct_pointer.rs | 17 +- .../tests/struct_with_anon_union.rs | 8 +- .../tests/struct_with_anon_union_1_0.rs | 17 +- .../tests/struct_with_anon_unnamed_struct.rs | 17 +- .../tests/struct_with_anon_unnamed_union.rs | 8 +- .../struct_with_anon_unnamed_union_1_0.rs | 17 +- .../tests/struct_with_bitfields.rs | 46 +- .../tests/struct_with_derive_debug.rs | 21 +- .../tests/struct_with_large_array.rs | 13 +- .../expectations/tests/struct_with_nesting.rs | 22 +- .../tests/struct_with_nesting_1_0.rs | 31 +- .../expectations/tests/struct_with_packing.rs | 9 +- .../expectations/tests/struct_with_struct.rs | 17 +- .../tests/struct_with_typedef_template_arg.rs | 12 +- tests/expectations/tests/template-fun-ty.rs | 17 +- .../tests/template-param-usage-0.rs | 9 +- .../tests/template-param-usage-1.rs | 9 +- .../tests/template-param-usage-10.rs | 9 +- .../tests/template-param-usage-11.rs | 9 +- .../tests/template-param-usage-12.rs | 9 +- .../tests/template-param-usage-13.rs | 9 +- .../tests/template-param-usage-14.rs | 9 +- .../tests/template-param-usage-15.rs | 9 +- .../tests/template-param-usage-2.rs | 9 +- .../tests/template-param-usage-3.rs | 13 +- .../tests/template-param-usage-4.rs | 9 +- .../tests/template-param-usage-5.rs | 9 +- .../tests/template-param-usage-6.rs | 9 +- .../tests/template-param-usage-7.rs | 9 +- .../tests/template-param-usage-8.rs | 9 +- .../tests/template-param-usage-9.rs | 9 +- tests/expectations/tests/template-with-var.rs | 9 +- tests/expectations/tests/template.rs | 54 ++- tests/expectations/tests/template_alias.rs | 9 +- .../tests/template_alias_basic.rs | 9 +- .../tests/template_alias_namespace.rs | 12 +- .../tests/template_partial_specification.rs | 8 +- .../template_typedef_transitive_param.rs | 9 +- tests/expectations/tests/template_typedefs.rs | 17 +- .../expectations/tests/templateref_opaque.rs | 9 +- .../test_multiple_header_calls_in_builder.rs | 86 +--- ...type-referenced-by-whitelisted-function.rs | 13 +- tests/expectations/tests/type_alias_empty.rs | 9 +- ..._alias_partial_template_especialization.rs | 9 +- .../tests/typedefd-array-as-function-arg.rs | 9 +- tests/expectations/tests/typeref.rs | 6 +- tests/expectations/tests/typeref_1_0.rs | 15 +- tests/expectations/tests/underscore.rs | 9 +- tests/expectations/tests/union-in-ns.rs | 7 +- tests/expectations/tests/union-in-ns_1_0.rs | 21 +- tests/expectations/tests/union_bitfield.rs | 38 +- .../expectations/tests/union_bitfield_1_0.rs | 53 ++- tests/expectations/tests/union_dtor.rs | 8 +- tests/expectations/tests/union_dtor_1_0.rs | 17 +- tests/expectations/tests/union_fields.rs | 13 +- tests/expectations/tests/union_fields_1_0.rs | 22 +- .../expectations/tests/union_template_1_0.rs | 9 +- .../tests/union_with_anon_struct.rs | 8 +- .../tests/union_with_anon_struct_1_0.rs | 17 +- .../tests/union_with_anon_struct_bitfield.rs | 24 +- .../union_with_anon_struct_bitfield_1_0.rs | 24 +- .../tests/union_with_anon_union.rs | 8 +- .../tests/union_with_anon_union_1_0.rs | 17 +- .../tests/union_with_anon_unnamed_struct.rs | 20 +- .../union_with_anon_unnamed_struct_1_0.rs | 29 +- .../tests/union_with_anon_unnamed_union.rs | 8 +- .../union_with_anon_unnamed_union_1_0.rs | 17 +- .../tests/union_with_big_member.rs | 24 +- .../tests/union_with_big_member_1_0.rs | 33 +- .../expectations/tests/union_with_nesting.rs | 12 +- .../tests/union_with_nesting_1_0.rs | 21 +- tests/expectations/tests/unknown_attr.rs | 6 +- tests/expectations/tests/use-core.rs | 11 +- tests/expectations/tests/use-core_1_0.rs | 19 +- tests/expectations/tests/using.rs | 9 +- tests/expectations/tests/var-tracing.rs | 9 +- tests/expectations/tests/variadic-method.rs | 9 +- .../tests/variadic_template_function.rs | 9 +- tests/expectations/tests/virtual_dtor.rs | 7 +- .../expectations/tests/virtual_inheritance.rs | 9 +- .../expectations/tests/virtual_overloaded.rs | 19 +- .../tests/vtable_recursive_sig.rs | 9 +- tests/expectations/tests/weird_bitfields.rs | 110 +++-- tests/expectations/tests/what_is_going_on.rs | 9 +- .../tests/whitelist-namespaces-basic.rs | 9 +- .../tests/whitelist-namespaces.rs | 13 +- tests/expectations/tests/whitelist_basic.rs | 9 +- tests/expectations/tests/whitelist_fix.rs | 8 +- tests/expectations/tests/whitelist_vars.rs | 7 +- .../whitelisted-item-references-no-hash.rs | 13 +- ...hitelisted-item-references-no-partialeq.rs | 13 +- .../whitelisted_item_references_no_copy.rs | 13 +- .../expectations/tests/win32-thiscall_1_0.rs | 9 +- .../tests/win32-thiscall_nightly.rs | 18 +- .../tests/with_array_pointers_arguments.rs | 10 +- .../tests/without_array_pointers_arguments.rs | 13 +- .../tests/zero-size-array-align.rs | 12 +- tests/expectations/tests/zero-sized-array.rs | 9 +- 386 files changed, 5490 insertions(+), 2180 deletions(-) diff --git a/tests/expectations/build.rs b/tests/expectations/build.rs index 4e83fc26c1..4652645823 100644 --- a/tests/expectations/build.rs +++ b/tests/expectations/build.rs @@ -8,8 +8,13 @@ use std::fs; use std::io::Write; use std::path::Path; -const LIBCLANG_VERSION_DIRS: &'static [&'static str] = - &["libclang-3.8", "libclang-3.9", "libclang-4", "libclang-5", "libclang-9"]; +const LIBCLANG_VERSION_DIRS: &'static [&'static str] = &[ + "libclang-3.8", + "libclang-3.9", + "libclang-4", + "libclang-5", + "libclang-9", +]; fn main() { println!("cargo:rerun-if-changed=build.rs"); @@ -27,13 +32,16 @@ fn main() { let entry = entry.unwrap(); let path = entry.path(); let path = path.canonicalize().unwrap_or_else(|_| path.into()); - if path.extension().map(|e| e.to_string_lossy()) != Some("rs".into()) { + if path.extension().map(|e| e.to_string_lossy()) != + Some("rs".into()) + { continue; } println!("cargo:rerun-if-changed={}", path.display()); - let module_name: String = path.display() + let module_name: String = path + .display() .to_string() .chars() .map(|c| match c { diff --git a/tests/expectations/src/lib.rs b/tests/expectations/src/lib.rs index e69de29bb2..8b13789179 100644 --- a/tests/expectations/src/lib.rs +++ b/tests/expectations/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs index 3a9e89984a..19151c7d52 100644 --- a/tests/expectations/tests/16-byte-alignment.rs +++ b/tests/expectations/tests/16-byte-alignment.rs @@ -47,8 +47,9 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .dport as *const _ as usize }, 0usize, concat!( @@ -60,8 +61,9 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .sport as *const _ as usize }, 2usize, concat!( @@ -86,7 +88,8 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sctp_tag as *const _ as usize + &(*(::std::ptr::null::())).sctp_tag + as *const _ as usize }, 0usize, concat!( @@ -115,7 +118,10 @@ fn bindgen_test_layout_rte_ipv4_tuple() { concat!("Alignment of ", stringify!(rte_ipv4_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -125,7 +131,10 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_addr as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -180,8 +189,9 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .dport as *const _ as usize }, 0usize, concat!( @@ -193,8 +203,9 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .sport as *const _ as usize }, 2usize, concat!( @@ -219,7 +230,8 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sctp_tag as *const _ as usize + &(*(::std::ptr::null::())).sctp_tag + as *const _ as usize }, 0usize, concat!( @@ -248,7 +260,10 @@ fn bindgen_test_layout_rte_ipv6_tuple() { concat!("Alignment of ", stringify!(rte_ipv6_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -258,7 +273,10 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_addr as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -294,7 +312,9 @@ fn bindgen_test_layout_rte_thash_tuple() { concat!("Alignment of ", stringify!(rte_thash_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).v4 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).v4 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -304,7 +324,9 @@ fn bindgen_test_layout_rte_thash_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).v6 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).v6 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs index ae219a7c18..b4b1d84624 100644 --- a/tests/expectations/tests/16-byte-alignment_1_0.rs +++ b/tests/expectations/tests/16-byte-alignment_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -57,7 +60,8 @@ pub struct rte_ipv4_tuple { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1 { - pub __bindgen_anon_1: __BindgenUnionField, + pub __bindgen_anon_1: + __BindgenUnionField, pub sctp_tag: __BindgenUnionField, pub bindgen_union_field: u32, } @@ -87,8 +91,9 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .dport as *const _ as usize }, 0usize, concat!( @@ -100,8 +105,9 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .sport as *const _ as usize }, 2usize, concat!( @@ -131,7 +137,8 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sctp_tag as *const _ as usize + &(*(::std::ptr::null::())).sctp_tag + as *const _ as usize }, 0usize, concat!( @@ -160,7 +167,10 @@ fn bindgen_test_layout_rte_ipv4_tuple() { concat!("Alignment of ", stringify!(rte_ipv4_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -170,7 +180,10 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_addr as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -195,7 +208,8 @@ pub struct rte_ipv6_tuple { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1 { - pub __bindgen_anon_1: __BindgenUnionField, + pub __bindgen_anon_1: + __BindgenUnionField, pub sctp_tag: __BindgenUnionField, pub bindgen_union_field: u32, } @@ -225,8 +239,9 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .dport as *const _ as usize }, 0usize, concat!( @@ -238,8 +253,9 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sport as *const _ - as usize + &(*(::std::ptr::null::( + ))) + .sport as *const _ as usize }, 2usize, concat!( @@ -269,7 +285,8 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).sctp_tag as *const _ as usize + &(*(::std::ptr::null::())).sctp_tag + as *const _ as usize }, 0usize, concat!( @@ -298,7 +315,10 @@ fn bindgen_test_layout_rte_ipv6_tuple() { concat!("Alignment of ", stringify!(rte_ipv6_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -308,7 +328,10 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_addr as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -338,7 +361,9 @@ fn bindgen_test_layout_rte_thash_tuple() { concat!("Size of: ", stringify!(rte_thash_tuple)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).v4 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).v4 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -348,7 +373,9 @@ fn bindgen_test_layout_rte_thash_tuple() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).v6 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).v6 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/381-decltype-alias.rs b/tests/expectations/tests/381-decltype-alias.rs index 7f2bb8787b..f8cf202918 100644 --- a/tests/expectations/tests/381-decltype-alias.rs +++ b/tests/expectations/tests/381-decltype-alias.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs index df52a6d58b..514541e326 100644 --- a/tests/expectations/tests/accessors.rs +++ b/tests/expectations/tests/accessors.rs @@ -31,7 +31,10 @@ fn bindgen_test_layout_SomeAccessors() { concat!("Alignment of ", stringify!(SomeAccessors)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mNoAccessor as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mNoAccessor as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -41,7 +44,10 @@ fn bindgen_test_layout_SomeAccessors() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBothAccessors as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBothAccessors as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -51,7 +57,10 @@ fn bindgen_test_layout_SomeAccessors() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mUnsafeAccessors as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mUnsafeAccessors + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -62,7 +71,8 @@ fn bindgen_test_layout_SomeAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mImmutableAccessor as *const _ as usize + &(*(::std::ptr::null::())).mImmutableAccessor + as *const _ as usize }, 12usize, concat!( @@ -87,7 +97,9 @@ impl SomeAccessors { &self.mUnsafeAccessors } #[inline] - pub unsafe fn get_mUnsafeAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { + pub unsafe fn get_mUnsafeAccessors_mut( + &mut self, + ) -> &mut ::std::os::raw::c_int { &mut self.mUnsafeAccessors } #[inline] @@ -115,7 +127,10 @@ fn bindgen_test_layout_AllAccessors() { concat!("Alignment of ", stringify!(AllAccessors)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBothAccessors as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBothAccessors as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -125,7 +140,10 @@ fn bindgen_test_layout_AllAccessors() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mAlsoBothAccessors as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mAlsoBothAccessors + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -174,7 +192,8 @@ fn bindgen_test_layout_AllUnsafeAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mBothAccessors as *const _ as usize + &(*(::std::ptr::null::())).mBothAccessors + as *const _ as usize }, 0usize, concat!( @@ -186,7 +205,8 @@ fn bindgen_test_layout_AllUnsafeAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mAlsoBothAccessors as *const _ as usize + &(*(::std::ptr::null::())).mAlsoBothAccessors + as *const _ as usize }, 4usize, concat!( @@ -203,7 +223,9 @@ impl AllUnsafeAccessors { &self.mBothAccessors } #[inline] - pub unsafe fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { + pub unsafe fn get_mBothAccessors_mut( + &mut self, + ) -> &mut ::std::os::raw::c_int { &mut self.mBothAccessors } #[inline] @@ -211,7 +233,9 @@ impl AllUnsafeAccessors { &self.mAlsoBothAccessors } #[inline] - pub unsafe fn get_mAlsoBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { + pub unsafe fn get_mAlsoBothAccessors_mut( + &mut self, + ) -> &mut ::std::os::raw::c_int { &mut self.mAlsoBothAccessors } } @@ -241,7 +265,8 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mBothAccessors as *const _ as usize + &(*(::std::ptr::null::())).mBothAccessors + as *const _ as usize }, 0usize, concat!( @@ -253,7 +278,8 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mNoAccessors as *const _ as usize + &(*(::std::ptr::null::())).mNoAccessors + as *const _ as usize }, 4usize, concat!( @@ -265,7 +291,8 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mUnsafeAccessors as *const _ as usize + &(*(::std::ptr::null::())).mUnsafeAccessors + as *const _ as usize }, 8usize, concat!( @@ -277,7 +304,8 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mImmutableAccessor as *const _ as usize + &(*(::std::ptr::null::())).mImmutableAccessor + as *const _ as usize }, 12usize, concat!( @@ -302,7 +330,9 @@ impl ContradictAccessors { &self.mUnsafeAccessors } #[inline] - pub unsafe fn get_mUnsafeAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { + pub unsafe fn get_mUnsafeAccessors_mut( + &mut self, + ) -> &mut ::std::os::raw::c_int { &mut self.mUnsafeAccessors } #[inline] @@ -329,7 +359,9 @@ fn bindgen_test_layout_Replaced() { concat!("Alignment of ", stringify!(Replaced)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mAccessor as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mAccessor as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -368,7 +400,9 @@ fn bindgen_test_layout_Wrapper() { concat!("Alignment of ", stringify!(Wrapper)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mReplaced as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mReplaced as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs index 49a771ac6b..b6a47cc093 100644 --- a/tests/expectations/tests/annotation_hide.rs +++ b/tests/expectations/tests/annotation_hide.rs @@ -45,7 +45,9 @@ fn bindgen_test_layout_NotAnnotated() { concat!("Alignment of ", stringify!(NotAnnotated)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).f as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs index 76d6089f90..f2d9ec252f 100644 --- a/tests/expectations/tests/anon_enum.rs +++ b/tests/expectations/tests/anon_enum.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialEq)] diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs index e109c90d66..6418549171 100644 --- a/tests/expectations/tests/anon_enum_trait.rs +++ b/tests/expectations/tests/anon_enum_trait.rs @@ -16,11 +16,16 @@ pub type DataType_value_type<_Tp> = _Tp; pub type DataType_work_type<_Tp> = DataType_value_type<_Tp>; pub type DataType_channel_type<_Tp> = DataType_value_type<_Tp>; pub type DataType_vec_type<_Tp> = DataType_value_type<_Tp>; -pub const DataType_generic_type: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type; -pub const DataType_depth: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type; -pub const DataType_channels: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type; -pub const DataType_fmt: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type; -pub const DataType_type_: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type; +pub const DataType_generic_type: DataType__bindgen_ty_1 = + DataType__bindgen_ty_1::generic_type; +pub const DataType_depth: DataType__bindgen_ty_1 = + DataType__bindgen_ty_1::generic_type; +pub const DataType_channels: DataType__bindgen_ty_1 = + DataType__bindgen_ty_1::generic_type; +pub const DataType_fmt: DataType__bindgen_ty_1 = + DataType__bindgen_ty_1::generic_type; +pub const DataType_type_: DataType__bindgen_ty_1 = + DataType__bindgen_ty_1::generic_type; #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum DataType__bindgen_ty_1 { diff --git a/tests/expectations/tests/anon_enum_whitelist.rs b/tests/expectations/tests/anon_enum_whitelist.rs index 267d922961..c109b317f7 100644 --- a/tests/expectations/tests/anon_enum_whitelist.rs +++ b/tests/expectations/tests/anon_enum_whitelist.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const NODE_FLAG_FOO: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_FOO; pub const NODE_FLAG_BAR: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_BAR; diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs index 5b5ed43c9e..66c64c0fbb 100644 --- a/tests/expectations/tests/anon_struct_in_union.rs +++ b/tests/expectations/tests/anon_struct_in_union.rs @@ -36,7 +36,10 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() { concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -59,7 +62,10 @@ fn bindgen_test_layout_s__bindgen_ty_1() { concat!("Alignment of ", stringify!(s__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).field as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).field as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs index d884002913..725c4e22fb 100644 --- a/tests/expectations/tests/anon_struct_in_union_1_0.rs +++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -76,7 +79,10 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() { concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -104,7 +110,10 @@ fn bindgen_test_layout_s__bindgen_ty_1() { concat!("Alignment of ", stringify!(s__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).field as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).field as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs index a9b6029234..ff91944d8f 100644 --- a/tests/expectations/tests/anon_union.rs +++ b/tests/expectations/tests/anon_union.rs @@ -15,7 +15,8 @@ pub struct TErrorResult { pub mUnionState: TErrorResult_UnionState, } impl TErrorResult_UnionState { - pub const HasException: TErrorResult_UnionState = TErrorResult_UnionState::HasMessage; + pub const HasException: TErrorResult_UnionState = + TErrorResult_UnionState::HasMessage; } #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/anon_union_1_0.rs b/tests/expectations/tests/anon_union_1_0.rs index e915237de4..3397c5515e 100644 --- a/tests/expectations/tests/anon_union_1_0.rs +++ b/tests/expectations/tests/anon_union_1_0.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -74,7 +79,8 @@ pub struct TErrorResult_DOMExceptionInfo { #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult__bindgen_ty_1 { pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>, - pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>, + pub mDOMExceptionInfo: + __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>, pub bindgen_union_field: u64, } impl Default for TErrorResult { diff --git a/tests/expectations/tests/anonymous-template-types.rs b/tests/expectations/tests/anonymous-template-types.rs index 0fedfe4532..c2cff3b8c3 100644 --- a/tests/expectations/tests/anonymous-template-types.rs +++ b/tests/expectations/tests/anonymous-template-types.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/arg_keyword.rs b/tests/expectations/tests/arg_keyword.rs index 54c036d886..1aab5ce1e0 100644 --- a/tests/expectations/tests/arg_keyword.rs +++ b/tests/expectations/tests/arg_keyword.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { #[link_name = "\u{1}_Z3fooPKc"] diff --git a/tests/expectations/tests/array-of-zero-sized-types.rs b/tests/expectations/tests/array-of-zero-sized-types.rs index 65442b942f..fa4d7a8a3d 100644 --- a/tests/expectations/tests/array-of-zero-sized-types.rs +++ b/tests/expectations/tests/array-of-zero-sized-types.rs @@ -46,7 +46,10 @@ fn bindgen_test_layout_HasArrayOfEmpty() { concat!("Alignment of ", stringify!(HasArrayOfEmpty)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).empties as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).empties as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/attribute_warn_unused_result.rs b/tests/expectations/tests/attribute_warn_unused_result.rs index 35ac4dd2b3..0230bc6289 100644 --- a/tests/expectations/tests/attribute_warn_unused_result.rs +++ b/tests/expectations/tests/attribute_warn_unused_result.rs @@ -28,12 +28,18 @@ fn bindgen_test_layout_Foo() { extern "C" { #[must_use] #[link_name = "\u{1}_ZN3Foo3fooEi"] - pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn Foo_foo( + this: *mut Foo, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } impl Foo { #[inline] #[must_use] - pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int { + pub unsafe fn foo( + &mut self, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { Foo_foo(self, arg1) } } diff --git a/tests/expectations/tests/attribute_warn_unused_result_no_attribute_detection.rs b/tests/expectations/tests/attribute_warn_unused_result_no_attribute_detection.rs index c60b19c6b0..b1c6eb9258 100644 --- a/tests/expectations/tests/attribute_warn_unused_result_no_attribute_detection.rs +++ b/tests/expectations/tests/attribute_warn_unused_result_no_attribute_detection.rs @@ -27,11 +27,17 @@ fn bindgen_test_layout_Foo() { } extern "C" { #[link_name = "\u{1}_ZN3Foo3fooEi"] - pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn Foo_foo( + this: *mut Foo, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } impl Foo { #[inline] - pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int { + pub unsafe fn foo( + &mut self, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { Foo_foo(self, arg1) } } diff --git a/tests/expectations/tests/attribute_warn_unused_result_pre_1_27.rs b/tests/expectations/tests/attribute_warn_unused_result_pre_1_27.rs index c60b19c6b0..b1c6eb9258 100644 --- a/tests/expectations/tests/attribute_warn_unused_result_pre_1_27.rs +++ b/tests/expectations/tests/attribute_warn_unused_result_pre_1_27.rs @@ -27,11 +27,17 @@ fn bindgen_test_layout_Foo() { } extern "C" { #[link_name = "\u{1}_ZN3Foo3fooEi"] - pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn Foo_foo( + this: *mut Foo, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } impl Foo { #[inline] - pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int { + pub unsafe fn foo( + &mut self, + arg1: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { Foo_foo(self, arg1) } } diff --git a/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs index 901bec60d2..7a4ac42ed0 100644 --- a/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs +++ b/tests/expectations/tests/bad-namespace-parenthood-inheritance.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/base-to-derived.rs b/tests/expectations/tests/base-to-derived.rs index 9df54d982e..528f1e17ed 100644 --- a/tests/expectations/tests/base-to-derived.rs +++ b/tests/expectations/tests/base-to-derived.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/bindgen-union-inside-namespace.rs b/tests/expectations/tests/bindgen-union-inside-namespace.rs index b2e6226c30..1b5ff81f9f 100644 --- a/tests/expectations/tests/bindgen-union-inside-namespace.rs +++ b/tests/expectations/tests/bindgen-union-inside-namespace.rs @@ -39,7 +39,10 @@ pub mod root { } impl ::std::marker::Copy for __BindgenUnionField {} impl ::std::fmt::Debug for __BindgenUnionField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fn fmt( + &self, + fmt: &mut ::std::fmt::Formatter<'_>, + ) -> ::std::fmt::Result { fmt.write_str("__BindgenUnionField") } } @@ -77,14 +80,28 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(foo) + ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bar as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(bar)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(bar) + ) ); } impl Clone for Bar { diff --git a/tests/expectations/tests/bitfield-32bit-overflow.rs b/tests/expectations/tests/bitfield-32bit-overflow.rs index 361b0e3ae0..cfd00ac3ca 100644 --- a/tests/expectations/tests/bitfield-32bit-overflow.rs +++ b/tests/expectations/tests/bitfield-32bit-overflow.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -109,7 +115,9 @@ fn bindgen_test_layout_MuchBitfield() { impl MuchBitfield { #[inline] pub fn m0(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_m0(&mut self, val: ::std::os::raw::c_char) { @@ -120,7 +128,9 @@ impl MuchBitfield { } #[inline] pub fn m1(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) + } } #[inline] pub fn set_m1(&mut self, val: ::std::os::raw::c_char) { @@ -131,7 +141,9 @@ impl MuchBitfield { } #[inline] pub fn m2(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) + } } #[inline] pub fn set_m2(&mut self, val: ::std::os::raw::c_char) { @@ -142,7 +154,9 @@ impl MuchBitfield { } #[inline] pub fn m3(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) + } } #[inline] pub fn set_m3(&mut self, val: ::std::os::raw::c_char) { @@ -153,7 +167,9 @@ impl MuchBitfield { } #[inline] pub fn m4(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) + } } #[inline] pub fn set_m4(&mut self, val: ::std::os::raw::c_char) { @@ -164,7 +180,9 @@ impl MuchBitfield { } #[inline] pub fn m5(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) + } } #[inline] pub fn set_m5(&mut self, val: ::std::os::raw::c_char) { @@ -175,7 +193,9 @@ impl MuchBitfield { } #[inline] pub fn m6(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) + } } #[inline] pub fn set_m6(&mut self, val: ::std::os::raw::c_char) { @@ -186,7 +206,9 @@ impl MuchBitfield { } #[inline] pub fn m7(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) + } } #[inline] pub fn set_m7(&mut self, val: ::std::os::raw::c_char) { @@ -197,7 +219,9 @@ impl MuchBitfield { } #[inline] pub fn m8(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) + } } #[inline] pub fn set_m8(&mut self, val: ::std::os::raw::c_char) { @@ -208,7 +232,9 @@ impl MuchBitfield { } #[inline] pub fn m9(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) + } } #[inline] pub fn set_m9(&mut self, val: ::std::os::raw::c_char) { @@ -219,7 +245,9 @@ impl MuchBitfield { } #[inline] pub fn m10(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) + } } #[inline] pub fn set_m10(&mut self, val: ::std::os::raw::c_char) { @@ -230,7 +258,9 @@ impl MuchBitfield { } #[inline] pub fn m11(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u8) + } } #[inline] pub fn set_m11(&mut self, val: ::std::os::raw::c_char) { @@ -241,7 +271,9 @@ impl MuchBitfield { } #[inline] pub fn m12(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u8) + } } #[inline] pub fn set_m12(&mut self, val: ::std::os::raw::c_char) { @@ -252,7 +284,9 @@ impl MuchBitfield { } #[inline] pub fn m13(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u8) + } } #[inline] pub fn set_m13(&mut self, val: ::std::os::raw::c_char) { @@ -263,7 +297,9 @@ impl MuchBitfield { } #[inline] pub fn m14(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u8) + } } #[inline] pub fn set_m14(&mut self, val: ::std::os::raw::c_char) { @@ -274,7 +310,9 @@ impl MuchBitfield { } #[inline] pub fn m15(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u8) + } } #[inline] pub fn set_m15(&mut self, val: ::std::os::raw::c_char) { @@ -285,7 +323,9 @@ impl MuchBitfield { } #[inline] pub fn m16(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u8) + } } #[inline] pub fn set_m16(&mut self, val: ::std::os::raw::c_char) { @@ -296,7 +336,9 @@ impl MuchBitfield { } #[inline] pub fn m17(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u8) + } } #[inline] pub fn set_m17(&mut self, val: ::std::os::raw::c_char) { @@ -307,7 +349,9 @@ impl MuchBitfield { } #[inline] pub fn m18(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u8) + } } #[inline] pub fn set_m18(&mut self, val: ::std::os::raw::c_char) { @@ -318,7 +362,9 @@ impl MuchBitfield { } #[inline] pub fn m19(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u8) + } } #[inline] pub fn set_m19(&mut self, val: ::std::os::raw::c_char) { @@ -329,7 +375,9 @@ impl MuchBitfield { } #[inline] pub fn m20(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u8) + } } #[inline] pub fn set_m20(&mut self, val: ::std::os::raw::c_char) { @@ -340,7 +388,9 @@ impl MuchBitfield { } #[inline] pub fn m21(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u8) + } } #[inline] pub fn set_m21(&mut self, val: ::std::os::raw::c_char) { @@ -351,7 +401,9 @@ impl MuchBitfield { } #[inline] pub fn m22(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u8) + } } #[inline] pub fn set_m22(&mut self, val: ::std::os::raw::c_char) { @@ -362,7 +414,9 @@ impl MuchBitfield { } #[inline] pub fn m23(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u8) + } } #[inline] pub fn set_m23(&mut self, val: ::std::os::raw::c_char) { @@ -373,7 +427,9 @@ impl MuchBitfield { } #[inline] pub fn m24(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u8) + } } #[inline] pub fn set_m24(&mut self, val: ::std::os::raw::c_char) { @@ -384,7 +440,9 @@ impl MuchBitfield { } #[inline] pub fn m25(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u8) + } } #[inline] pub fn set_m25(&mut self, val: ::std::os::raw::c_char) { @@ -395,7 +453,9 @@ impl MuchBitfield { } #[inline] pub fn m26(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u8) + } } #[inline] pub fn set_m26(&mut self, val: ::std::os::raw::c_char) { @@ -406,7 +466,9 @@ impl MuchBitfield { } #[inline] pub fn m27(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u8) + } } #[inline] pub fn set_m27(&mut self, val: ::std::os::raw::c_char) { @@ -417,7 +479,9 @@ impl MuchBitfield { } #[inline] pub fn m28(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u8) + } } #[inline] pub fn set_m28(&mut self, val: ::std::os::raw::c_char) { @@ -428,7 +492,9 @@ impl MuchBitfield { } #[inline] pub fn m29(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u8) + } } #[inline] pub fn set_m29(&mut self, val: ::std::os::raw::c_char) { @@ -439,7 +505,9 @@ impl MuchBitfield { } #[inline] pub fn m30(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u8) + } } #[inline] pub fn set_m30(&mut self, val: ::std::os::raw::c_char) { @@ -450,7 +518,9 @@ impl MuchBitfield { } #[inline] pub fn m31(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) + } } #[inline] pub fn set_m31(&mut self, val: ::std::os::raw::c_char) { @@ -461,7 +531,9 @@ impl MuchBitfield { } #[inline] pub fn m32(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u8) + } } #[inline] pub fn set_m32(&mut self, val: ::std::os::raw::c_char) { @@ -506,8 +578,10 @@ impl MuchBitfield { m31: ::std::os::raw::c_char, m32: ::std::os::raw::c_char, ) -> __BindgenBitfieldUnit<[u8; 5usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 5usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 5usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let m0: u8 = unsafe { ::std::mem::transmute(m0) }; m0 as u64 diff --git a/tests/expectations/tests/bitfield-large.rs b/tests/expectations/tests/bitfield-large.rs index 6597e9672c..b3f4e5cfb2 100644 --- a/tests/expectations/tests/bitfield-large.rs +++ b/tests/expectations/tests/bitfield-large.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,7 +116,9 @@ fn bindgen_test_layout_HasBigBitfield() { impl HasBigBitfield { #[inline] pub fn x(&self) -> i128 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 128u8) as u128) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 128u8) as u128) + } } #[inline] pub fn set_x(&mut self, val: i128) { @@ -120,9 +128,13 @@ impl HasBigBitfield { } } #[inline] - pub fn new_bitfield_1(x: i128) -> __BindgenBitfieldUnit<[u8; 16usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize], u64> = - Default::default(); + pub fn new_bitfield_1( + x: i128, + ) -> __BindgenBitfieldUnit<[u8; 16usize], u64> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 16usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 128u8, { let x: u128 = unsafe { ::std::mem::transmute(x) }; x as u64 @@ -152,7 +164,9 @@ fn bindgen_test_layout_HasTwoBigBitfields() { impl HasTwoBigBitfields { #[inline] pub fn x(&self) -> i128 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 80u8) as u128) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 80u8) as u128) + } } #[inline] pub fn set_x(&mut self, val: i128) { @@ -163,7 +177,9 @@ impl HasTwoBigBitfields { } #[inline] pub fn y(&self) -> i128 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 48u8) as u128) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(80usize, 48u8) as u128) + } } #[inline] pub fn set_y(&mut self, val: i128) { @@ -173,9 +189,14 @@ impl HasTwoBigBitfields { } } #[inline] - pub fn new_bitfield_1(x: i128, y: i128) -> __BindgenBitfieldUnit<[u8; 16usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize], u64> = - Default::default(); + pub fn new_bitfield_1( + x: i128, + y: i128, + ) -> __BindgenBitfieldUnit<[u8; 16usize], u64> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 16usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 80u8, { let x: u128 = unsafe { ::std::mem::transmute(x) }; x as u64 diff --git a/tests/expectations/tests/bitfield-method-same-name.rs b/tests/expectations/tests/bitfield-method-same-name.rs index a105f026b5..bea1734d5d 100644 --- a/tests/expectations/tests/bitfield-method-same-name.rs +++ b/tests/expectations/tests/bitfield-method-same-name.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -121,7 +127,9 @@ extern "C" { impl Foo { #[inline] pub fn type__bindgen_bitfield(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) + } } #[inline] pub fn set_type__bindgen_bitfield(&mut self, val: ::std::os::raw::c_char) { @@ -134,8 +142,10 @@ impl Foo { pub fn new_bitfield_1( type__bindgen_bitfield: ::std::os::raw::c_char, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { let type__bindgen_bitfield: u8 = unsafe { ::std::mem::transmute(type__bindgen_bitfield) }; diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs index 7fd1f2eb2a..3c6da12246 100644 --- a/tests/expectations/tests/bitfield_align.rs +++ b/tests/expectations/tests/bitfield_align.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -122,7 +128,9 @@ fn bindgen_test_layout_A() { impl A { #[inline] pub fn b1(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) + } } #[inline] pub fn set_b1(&mut self, val: ::std::os::raw::c_uint) { @@ -133,7 +141,9 @@ impl A { } #[inline] pub fn b2(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) + } } #[inline] pub fn set_b2(&mut self, val: ::std::os::raw::c_uint) { @@ -144,7 +154,9 @@ impl A { } #[inline] pub fn b3(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) + } } #[inline] pub fn set_b3(&mut self, val: ::std::os::raw::c_uint) { @@ -155,7 +167,9 @@ impl A { } #[inline] pub fn b4(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) + } } #[inline] pub fn set_b4(&mut self, val: ::std::os::raw::c_uint) { @@ -166,7 +180,9 @@ impl A { } #[inline] pub fn b5(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) + } } #[inline] pub fn set_b5(&mut self, val: ::std::os::raw::c_uint) { @@ -177,7 +193,9 @@ impl A { } #[inline] pub fn b6(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) + } } #[inline] pub fn set_b6(&mut self, val: ::std::os::raw::c_uint) { @@ -188,7 +206,9 @@ impl A { } #[inline] pub fn b7(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) + } } #[inline] pub fn set_b7(&mut self, val: ::std::os::raw::c_uint) { @@ -199,7 +219,9 @@ impl A { } #[inline] pub fn b8(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) + } } #[inline] pub fn set_b8(&mut self, val: ::std::os::raw::c_uint) { @@ -210,7 +232,9 @@ impl A { } #[inline] pub fn b9(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) + } } #[inline] pub fn set_b9(&mut self, val: ::std::os::raw::c_uint) { @@ -221,7 +245,9 @@ impl A { } #[inline] pub fn b10(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) + } } #[inline] pub fn set_b10(&mut self, val: ::std::os::raw::c_uint) { @@ -243,8 +269,10 @@ impl A { b9: ::std::os::raw::c_uint, b10: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let b1: u32 = unsafe { ::std::mem::transmute(b1) }; b1 as u64 @@ -310,7 +338,9 @@ fn bindgen_test_layout_B() { impl B { #[inline] pub fn foo(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32) + } } #[inline] pub fn set_foo(&mut self, val: ::std::os::raw::c_uint) { @@ -321,7 +351,9 @@ impl B { } #[inline] pub fn bar(&self) -> ::std::os::raw::c_uchar { - unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) + } } #[inline] pub fn set_bar(&mut self, val: ::std::os::raw::c_uchar) { @@ -335,8 +367,10 @@ impl B { foo: ::std::os::raw::c_uint, bar: ::std::os::raw::c_uchar, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 31u8, { let foo: u32 = unsafe { ::std::mem::transmute(foo) }; foo as u64 @@ -381,7 +415,9 @@ fn bindgen_test_layout_C() { impl C { #[inline] pub fn b1(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) + } } #[inline] pub fn set_b1(&mut self, val: ::std::os::raw::c_uint) { @@ -392,7 +428,9 @@ impl C { } #[inline] pub fn b2(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) + } } #[inline] pub fn set_b2(&mut self, val: ::std::os::raw::c_uint) { @@ -406,8 +444,10 @@ impl C { b1: ::std::os::raw::c_uint, b2: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let b1: u32 = unsafe { ::std::mem::transmute(b1) }; b1 as u64 @@ -442,7 +482,9 @@ fn bindgen_test_layout_Date1() { impl Date1 { #[inline] pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) + } } #[inline] pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -453,7 +495,9 @@ impl Date1 { } #[inline] pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) + } } #[inline] pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -464,7 +508,9 @@ impl Date1 { } #[inline] pub fn nMonth(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) + } } #[inline] pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) { @@ -475,7 +521,9 @@ impl Date1 { } #[inline] pub fn nYear(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) + } } #[inline] pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) { @@ -491,8 +539,10 @@ impl Date1 { nMonth: ::std::os::raw::c_ushort, nYear: ::std::os::raw::c_ushort, ) -> __BindgenBitfieldUnit<[u8; 3usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 3usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) }; nWeekDay as u64 @@ -534,7 +584,9 @@ fn bindgen_test_layout_Date2() { impl Date2 { #[inline] pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) + } } #[inline] pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -545,7 +597,9 @@ impl Date2 { } #[inline] pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) + } } #[inline] pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -556,7 +610,9 @@ impl Date2 { } #[inline] pub fn nMonth(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) + } } #[inline] pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) { @@ -567,7 +623,9 @@ impl Date2 { } #[inline] pub fn nYear(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) + } } #[inline] pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) { @@ -578,7 +636,9 @@ impl Date2 { } #[inline] pub fn byte(&self) -> ::std::os::raw::c_uchar { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8) + } } #[inline] pub fn set_byte(&mut self, val: ::std::os::raw::c_uchar) { @@ -595,8 +655,10 @@ impl Date2 { nYear: ::std::os::raw::c_ushort, byte: ::std::os::raw::c_uchar, ) -> __BindgenBitfieldUnit<[u8; 4usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) }; nWeekDay as u64 @@ -653,7 +715,9 @@ fn bindgen_test_layout_Date3() { impl Date3 { #[inline] pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) + } } #[inline] pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -664,7 +728,9 @@ impl Date3 { } #[inline] pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) + } } #[inline] pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) { @@ -675,7 +741,9 @@ impl Date3 { } #[inline] pub fn nMonth(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) + } } #[inline] pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) { @@ -686,7 +754,9 @@ impl Date3 { } #[inline] pub fn nYear(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) + } } #[inline] pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) { @@ -702,8 +772,10 @@ impl Date3 { nMonth: ::std::os::raw::c_ushort, nYear: ::std::os::raw::c_ushort, ) -> __BindgenBitfieldUnit<[u8; 3usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 3usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) }; nWeekDay as u64 diff --git a/tests/expectations/tests/bitfield_align_2.rs b/tests/expectations/tests/bitfield_align_2.rs index ee3cfea5e5..277d828309 100644 --- a/tests/expectations/tests/bitfield_align_2.rs +++ b/tests/expectations/tests/bitfield_align_2.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -123,7 +129,9 @@ impl Default for TaggedPtr { impl TaggedPtr { #[inline] pub fn tag(&self) -> MyEnum { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) + } } #[inline] pub fn set_tag(&mut self, val: MyEnum) { @@ -134,7 +142,9 @@ impl TaggedPtr { } #[inline] pub fn ptr(&self) -> ::std::os::raw::c_long { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 62u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 62u8) as u64) + } } #[inline] pub fn set_ptr(&mut self, val: ::std::os::raw::c_long) { @@ -148,8 +158,10 @@ impl TaggedPtr { tag: MyEnum, ptr: ::std::os::raw::c_long, ) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u64> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 2u8, { let tag: u32 = unsafe { ::std::mem::transmute(tag) }; tag as u64 diff --git a/tests/expectations/tests/bitfield_method_mangling.rs b/tests/expectations/tests/bitfield_method_mangling.rs index 9989bfe09e..a08292d399 100644 --- a/tests/expectations/tests/bitfield_method_mangling.rs +++ b/tests/expectations/tests/bitfield_method_mangling.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,7 +116,9 @@ fn bindgen_test_layout_mach_msg_type_descriptor_t() { impl mach_msg_type_descriptor_t { #[inline] pub fn pad3(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) + } } #[inline] pub fn set_pad3(&mut self, val: ::std::os::raw::c_uint) { @@ -121,7 +129,9 @@ impl mach_msg_type_descriptor_t { } #[inline] pub fn type_(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u32) + } } #[inline] pub fn set_type(&mut self, val: ::std::os::raw::c_uint) { @@ -135,8 +145,10 @@ impl mach_msg_type_descriptor_t { pad3: ::std::os::raw::c_uint, type_: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 24u8, { let pad3: u32 = unsafe { ::std::mem::transmute(pad3) }; pad3 as u64 diff --git a/tests/expectations/tests/blacklist-and-impl-debug.rs b/tests/expectations/tests/blacklist-and-impl-debug.rs index 69f28a56bb..21c8d9769d 100644 --- a/tests/expectations/tests/blacklist-and-impl-debug.rs +++ b/tests/expectations/tests/blacklist-and-impl-debug.rs @@ -27,7 +27,10 @@ fn bindgen_test_layout_ShouldManuallyImplDebug() { concat!("Alignment of ", stringify!(ShouldManuallyImplDebug)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/block_return_type.rs b/tests/expectations/tests/block_return_type.rs index 7779540c93..6809f609a2 100644 --- a/tests/expectations/tests/block_return_type.rs +++ b/tests/expectations/tests/block_return_type.rs @@ -12,5 +12,7 @@ extern crate block; extern "C" { pub fn func() -> _bindgen_ty_id_4; } -pub type _bindgen_ty_id_4 = - *const ::block::Block<(::std::os::raw::c_int, ::std::os::raw::c_int), ::std::os::raw::c_int>; +pub type _bindgen_ty_id_4 = *const ::block::Block< + (::std::os::raw::c_int, ::std::os::raw::c_int), + ::std::os::raw::c_int, +>; diff --git a/tests/expectations/tests/blocks-signature.rs b/tests/expectations/tests/blocks-signature.rs index d01e5172b9..a45af3090c 100644 --- a/tests/expectations/tests/blocks-signature.rs +++ b/tests/expectations/tests/blocks-signature.rs @@ -17,7 +17,10 @@ pub type dispatch_data_t = *mut ::std::os::raw::c_void; pub type dispatch_data_applier_t = _bindgen_ty_id_40; extern "C" { #[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"] - pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool; + pub fn dispatch_data_apply( + data: dispatch_data_t, + applier: dispatch_data_applier_t, + ) -> bool; } extern "C" { #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"] @@ -46,7 +49,10 @@ fn bindgen_test_layout_contains_block_pointers() { concat!("Alignment of ", stringify!(contains_block_pointers)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).val as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).val as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -56,7 +62,10 @@ fn bindgen_test_layout_contains_block_pointers() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ptr_val as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ptr_val + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -72,10 +81,13 @@ impl Default for contains_block_pointers { } } pub type _bindgen_ty_id_33 = *const ::block::Block<(), ()>; -pub type _bindgen_ty_id_40 = - *const ::block::Block<(dispatch_data_t, usize, *const ::std::os::raw::c_void, usize), bool>; +pub type _bindgen_ty_id_40 = *const ::block::Block< + (dispatch_data_t, usize, *const ::std::os::raw::c_void, usize), + bool, +>; pub type _bindgen_ty_id_50 = *const ::block::Block<(usize,), ()>; pub type _bindgen_ty_id_56 = *const ::block::Block<(usize,), ()>; pub type contains_block_pointers__bindgen_ty_id_61 = *const ::block::Block<(::std::os::raw::c_int,), ()>; -pub type _bindgen_ty_id_68 = *const ::block::Block<(::std::os::raw::c_int,), ()>; +pub type _bindgen_ty_id_68 = + *const ::block::Block<(::std::os::raw::c_int,), ()>; diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs index 1e1def7f93..6a0dac194f 100644 --- a/tests/expectations/tests/blocks.rs +++ b/tests/expectations/tests/blocks.rs @@ -16,7 +16,10 @@ pub type dispatch_data_t = *mut ::std::os::raw::c_void; pub type dispatch_data_applier_t = *mut ::std::os::raw::c_void; extern "C" { #[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"] - pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool; + pub fn dispatch_data_apply( + data: dispatch_data_t, + applier: dispatch_data_applier_t, + ) -> bool; } extern "C" { #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"] @@ -45,7 +48,10 @@ fn bindgen_test_layout_contains_block_pointers() { concat!("Alignment of ", stringify!(contains_block_pointers)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).val as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).val as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -55,7 +61,10 @@ fn bindgen_test_layout_contains_block_pointers() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ptr_val as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ptr_val + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/builtin-template.rs b/tests/expectations/tests/builtin-template.rs index 398c3c4aaf..0a6ded4946 100644 --- a/tests/expectations/tests/builtin-template.rs +++ b/tests/expectations/tests/builtin-template.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type std_make_integer_sequence = u8; diff --git a/tests/expectations/tests/c-empty-layout.rs b/tests/expectations/tests/c-empty-layout.rs index a14022f54f..1ed41db89d 100644 --- a/tests/expectations/tests/c-empty-layout.rs +++ b/tests/expectations/tests/c-empty-layout.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/call-conv-typedef.rs b/tests/expectations/tests/call-conv-typedef.rs index f30d235689..db37da0ec3 100644 --- a/tests/expectations/tests/call-conv-typedef.rs +++ b/tests/expectations/tests/call-conv-typedef.rs @@ -9,5 +9,6 @@ #![cfg(not(test))] pub type void_fn = ::std::option::Option; -pub type fn_ = - ::std::option::Option void_fn>; +pub type fn_ = ::std::option::Option< + unsafe extern "stdcall" fn(id: ::std::os::raw::c_int) -> void_fn, +>; diff --git a/tests/expectations/tests/canonical_path_without_namespacing.rs b/tests/expectations/tests/canonical_path_without_namespacing.rs index 02955e4414..cdc5b512d9 100644 --- a/tests/expectations/tests/canonical_path_without_namespacing.rs +++ b/tests/expectations/tests/canonical_path_without_namespacing.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs index ffaae3d190..55303e5d66 100644 --- a/tests/expectations/tests/char.rs +++ b/tests/expectations/tests/char.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type Char = ::std::os::raw::c_char; pub type SChar = ::std::os::raw::c_schar; diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs index be1380417a..3a9927bcc1 100644 --- a/tests/expectations/tests/class.rs +++ b/tests/expectations/tests/class.rs @@ -101,7 +101,10 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -112,7 +115,8 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).big_array as *const _ as usize + &(*(::std::ptr::null::())).big_array + as *const _ as usize }, 4usize, concat!( @@ -124,8 +128,8 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).zero_length_array as *const _ - as usize + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize }, 37usize, concat!( @@ -160,7 +164,10 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -171,8 +178,8 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).zero_length_array as *const _ - as usize + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize }, 4usize, concat!( @@ -267,7 +274,8 @@ pub struct C_with_zero_length_array_and_incomplete_array_2 { #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::( + ), 4usize, concat!( "Size of: ", @@ -275,7 +283,8 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::( + ), 4usize, concat!( "Alignment of ", @@ -387,7 +396,9 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -425,11 +436,15 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { } extern "C" { #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); + pub fn RealAbstractionWithTonsOfMethods_bar( + this: *const RealAbstractionWithTonsOfMethods, + ); } extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); + pub fn RealAbstractionWithTonsOfMethods_bar1( + this: *mut RealAbstractionWithTonsOfMethods, + ); } extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs index b35e8814cc..b1ac55023c 100644 --- a/tests/expectations/tests/class_1_0.rs +++ b/tests/expectations/tests/class_1_0.rs @@ -154,7 +154,10 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -165,7 +168,8 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).big_array as *const _ as usize + &(*(::std::ptr::null::())).big_array + as *const _ as usize }, 4usize, concat!( @@ -177,8 +181,8 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).zero_length_array as *const _ - as usize + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize }, 37usize, concat!( @@ -213,7 +217,10 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -224,8 +231,8 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).zero_length_array as *const _ - as usize + &(*(::std::ptr::null::())) + .zero_length_array as *const _ as usize }, 4usize, concat!( @@ -320,7 +327,8 @@ pub struct C_with_zero_length_array_and_incomplete_array_2 { #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::( + ), 4usize, concat!( "Size of: ", @@ -328,7 +336,8 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::( + ), 4usize, concat!( "Alignment of ", @@ -440,7 +449,9 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -478,11 +489,15 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { } extern "C" { #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); + pub fn RealAbstractionWithTonsOfMethods_bar( + this: *const RealAbstractionWithTonsOfMethods, + ); } extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); + pub fn RealAbstractionWithTonsOfMethods_bar1( + this: *mut RealAbstractionWithTonsOfMethods, + ); } extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index efd7dac256..80cb621fab 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -27,7 +30,9 @@ fn bindgen_test_layout_A_B() { concat!("Alignment of ", stringify!(A_B)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).member_b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).member_b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs index 7da77892b9..729e517a5f 100644 --- a/tests/expectations/tests/class_no_members.rs +++ b/tests/expectations/tests/class_no_members.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -59,7 +62,8 @@ fn bindgen_test_layout_whatever_child_with_member() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).m_member as *const _ as usize + &(*(::std::ptr::null::())).m_member + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs index c28366c134..979c51cbd7 100644 --- a/tests/expectations/tests/class_static.rs +++ b/tests/expectations/tests/class_static.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -15,7 +18,8 @@ extern "C" { } extern "C" { #[link_name = "\u{1}_ZN7MyClass26example_check_no_collisionE"] - pub static mut MyClass_example_check_no_collision: *const ::std::os::raw::c_int; + pub static mut MyClass_example_check_no_collision: + *const ::std::os::raw::c_int; } #[test] fn bindgen_test_layout_MyClass() { diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs index c0945c4337..9e4841d35f 100644 --- a/tests/expectations/tests/class_static_const.rs +++ b/tests/expectations/tests/class_static_const.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs index d1f6a5c011..c88f25c5c9 100644 --- a/tests/expectations/tests/class_use_as.rs +++ b/tests/expectations/tests/class_use_as.rs @@ -26,7 +26,10 @@ fn bindgen_test_layout_whatever() { concat!("Alignment of ", stringify!(whatever)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).replacement as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).replacement as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs index 4a5b090d8a..9baa1b4d2b 100644 --- a/tests/expectations/tests/class_with_dtor.rs +++ b/tests/expectations/tests/class_with_dtor.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] @@ -34,7 +37,10 @@ fn bindgen_test_layout_WithoutDtor() { concat!("Alignment of ", stringify!(WithoutDtor)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).shouldBeWithDtor as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).shouldBeWithDtor as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs index 577dec6f55..939143d632 100644 --- a/tests/expectations/tests/class_with_inner_struct.rs +++ b/tests/expectations/tests/class_with_inner_struct.rs @@ -33,7 +33,9 @@ fn bindgen_test_layout_A_Segment() { concat!("Alignment of ", stringify!(A_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -43,7 +45,9 @@ fn bindgen_test_layout_A_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -72,7 +76,9 @@ fn bindgen_test_layout_A__bindgen_ty_1() { concat!("Alignment of ", stringify!(A__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).f as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -106,7 +112,9 @@ fn bindgen_test_layout_A__bindgen_ty_2() { concat!("Alignment of ", stringify!(A__bindgen_ty_2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).d as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -139,7 +147,9 @@ fn bindgen_test_layout_A() { concat!("Offset of field: ", stringify!(A), "::", stringify!(c)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).named_union as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).named_union as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -178,7 +188,9 @@ fn bindgen_test_layout_B_Segment() { concat!("Alignment of ", stringify!(B_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -188,7 +200,9 @@ fn bindgen_test_layout_B_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -259,7 +273,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mX1 as *const _ as usize + &(*(::std::ptr::null::())).mX1 + as *const _ as usize }, 0usize, concat!( @@ -271,7 +286,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mY1 as *const _ as usize + &(*(::std::ptr::null::())).mY1 + as *const _ as usize }, 4usize, concat!( @@ -283,7 +299,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mX2 as *const _ as usize + &(*(::std::ptr::null::())).mX2 + as *const _ as usize }, 8usize, concat!( @@ -295,7 +312,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mY2 as *const _ as usize + &(*(::std::ptr::null::())).mY2 + as *const _ as usize }, 12usize, concat!( @@ -326,8 +344,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mStepSyntax as *const _ - as usize + &(*(::std::ptr::null::())) + .mStepSyntax as *const _ as usize }, 0usize, concat!( @@ -339,7 +357,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mSteps as *const _ as usize + &(*(::std::ptr::null::())).mSteps + as *const _ as usize }, 4usize, concat!( @@ -368,7 +387,10 @@ fn bindgen_test_layout_C__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFunc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFunc as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -402,7 +424,9 @@ fn bindgen_test_layout_C_Segment() { concat!("Alignment of ", stringify!(C_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -412,7 +436,9 @@ fn bindgen_test_layout_C_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs index 3a8ca37a75..3fd71bd00b 100644 --- a/tests/expectations/tests/class_with_inner_struct_1_0.rs +++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -71,7 +76,9 @@ fn bindgen_test_layout_A_Segment() { concat!("Alignment of ", stringify!(A_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -81,7 +88,9 @@ fn bindgen_test_layout_A_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -115,7 +124,9 @@ fn bindgen_test_layout_A__bindgen_ty_1() { concat!("Alignment of ", stringify!(A__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).f as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -149,7 +160,9 @@ fn bindgen_test_layout_A__bindgen_ty_2() { concat!("Alignment of ", stringify!(A__bindgen_ty_2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).d as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -182,7 +195,9 @@ fn bindgen_test_layout_A() { concat!("Offset of field: ", stringify!(A), "::", stringify!(c)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).named_union as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).named_union as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -221,7 +236,9 @@ fn bindgen_test_layout_B_Segment() { concat!("Alignment of ", stringify!(B_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -231,7 +248,9 @@ fn bindgen_test_layout_B_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -312,7 +331,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mX1 as *const _ as usize + &(*(::std::ptr::null::())).mX1 + as *const _ as usize }, 0usize, concat!( @@ -324,7 +344,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mY1 as *const _ as usize + &(*(::std::ptr::null::())).mY1 + as *const _ as usize }, 4usize, concat!( @@ -336,7 +357,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mX2 as *const _ as usize + &(*(::std::ptr::null::())).mX2 + as *const _ as usize }, 8usize, concat!( @@ -348,7 +370,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mY2 as *const _ as usize + &(*(::std::ptr::null::())).mY2 + as *const _ as usize }, 12usize, concat!( @@ -384,8 +407,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mStepSyntax as *const _ - as usize + &(*(::std::ptr::null::())) + .mStepSyntax as *const _ as usize }, 0usize, concat!( @@ -397,7 +420,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mSteps as *const _ as usize + &(*(::std::ptr::null::())).mSteps + as *const _ as usize }, 4usize, concat!( @@ -431,7 +455,10 @@ fn bindgen_test_layout_C__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFunc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFunc as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -465,7 +492,9 @@ fn bindgen_test_layout_C_Segment() { concat!("Alignment of ", stringify!(C_Segment)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).begin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).begin as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -475,7 +504,9 @@ fn bindgen_test_layout_C_Segment() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).end as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).end as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs index 221ed5d7cb..597b5cdb08 100644 --- a/tests/expectations/tests/class_with_typedef.rs +++ b/tests/expectations/tests/class_with_typedef.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type AnotherInt = ::std::os::raw::c_int; #[repr(C)] diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs index 2e44746ddd..e208b3bdf5 100644 --- a/tests/expectations/tests/comment-indent.rs +++ b/tests/expectations/tests/comment-indent.rs @@ -83,7 +83,9 @@ pub mod root { concat!("Alignment of ", stringify!(Baz)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).member as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs index 317bb99a5e..f40e53a0a0 100644 --- a/tests/expectations/tests/complex.rs +++ b/tests/expectations/tests/complex.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] #[repr(C)] @@ -28,7 +31,9 @@ fn bindgen_test_layout_TestDouble() { concat!("Alignment of ", stringify!(TestDouble)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mMember as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mMember as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -56,7 +61,10 @@ fn bindgen_test_layout_TestDoublePtr() { concat!("Alignment of ", stringify!(TestDoublePtr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mMember as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mMember as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +97,9 @@ fn bindgen_test_layout_TestFloat() { concat!("Alignment of ", stringify!(TestFloat)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mMember as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mMember as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -117,7 +127,10 @@ fn bindgen_test_layout_TestFloatPtr() { concat!("Alignment of ", stringify!(TestFloatPtr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mMember as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mMember as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/complex_global.rs b/tests/expectations/tests/complex_global.rs index 417ccd4a01..0ce2f7f3b3 100644 --- a/tests/expectations/tests/complex_global.rs +++ b/tests/expectations/tests/complex_global.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] #[repr(C)] diff --git a/tests/expectations/tests/const-const-mut-ptr.rs b/tests/expectations/tests/const-const-mut-ptr.rs index ecfbf58ff6..b214011699 100644 --- a/tests/expectations/tests/const-const-mut-ptr.rs +++ b/tests/expectations/tests/const-const-mut-ptr.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/const_array_fn_arg.rs b/tests/expectations/tests/const_array_fn_arg.rs index 5e934bcbb5..289be3686a 100644 --- a/tests/expectations/tests/const_array_fn_arg.rs +++ b/tests/expectations/tests/const_array_fn_arg.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn f(a: *const ::std::os::raw::c_int); diff --git a/tests/expectations/tests/const_enum_unnamed.rs b/tests/expectations/tests/const_enum_unnamed.rs index 6b04c7dd4c..ea5a8f05b8 100644 --- a/tests/expectations/tests/const_enum_unnamed.rs +++ b/tests/expectations/tests/const_enum_unnamed.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const FOO_BAR: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAR; pub const FOO_BAZ: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAZ; diff --git a/tests/expectations/tests/const_ptr.rs b/tests/expectations/tests/const_ptr.rs index 9831cd8dc4..4f2e60bc2e 100644 --- a/tests/expectations/tests/const_ptr.rs +++ b/tests/expectations/tests/const_ptr.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(bar: *const ::std::os::raw::c_void); diff --git a/tests/expectations/tests/const_resolved_ty.rs b/tests/expectations/tests/const_resolved_ty.rs index 7c4b91b007..536fee961d 100644 --- a/tests/expectations/tests/const_resolved_ty.rs +++ b/tests/expectations/tests/const_resolved_ty.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(foo: *const u8); diff --git a/tests/expectations/tests/const_tparam.rs b/tests/expectations/tests/const_tparam.rs index c7863931c0..2512d17df7 100644 --- a/tests/expectations/tests/const_tparam.rs +++ b/tests/expectations/tests/const_tparam.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/constant-non-specialized-tp.rs b/tests/expectations/tests/constant-non-specialized-tp.rs index 8be8e5d3b2..ece462ab7d 100644 --- a/tests/expectations/tests/constant-non-specialized-tp.rs +++ b/tests/expectations/tests/constant-non-specialized-tp.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/constify-all-enums.rs b/tests/expectations/tests/constify-all-enums.rs index b2e1e974ea..6a8dc3e39d 100644 --- a/tests/expectations/tests/constify-all-enums.rs +++ b/tests/expectations/tests/constify-all-enums.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const foo_THIS: foo = 0; pub const foo_SHOULD_BE: foo = 1; @@ -24,7 +29,10 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).this_should_work as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).this_should_work as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/constify-enum.rs b/tests/expectations/tests/constify-enum.rs index f1dc139c1d..24d6ce20c3 100644 --- a/tests/expectations/tests/constify-enum.rs +++ b/tests/expectations/tests/constify-enum.rs @@ -7,10 +7,12 @@ non_upper_case_globals )] -pub const nsCSSPropertyID_eCSSProperty_COUNT_unexistingVariantValue: nsCSSPropertyID = +pub const nsCSSPropertyID_eCSSProperty_COUNT_unexistingVariantValue: + nsCSSPropertyID = nsCSSPropertyID::eCSSProperty_COUNT_unexistingVariantValue; impl nsCSSPropertyID { - pub const eCSSProperty_COUNT: nsCSSPropertyID = nsCSSPropertyID::eCSSPropertyAlias_aa; + pub const eCSSProperty_COUNT: nsCSSPropertyID = + nsCSSPropertyID::eCSSPropertyAlias_aa; } #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/constify-module-enums-basic.rs b/tests/expectations/tests/constify-module-enums-basic.rs index 342e5ba525..db20058778 100644 --- a/tests/expectations/tests/constify-module-enums-basic.rs +++ b/tests/expectations/tests/constify-module-enums-basic.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod foo { pub type Type = u32; @@ -28,7 +33,10 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).this_should_work as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).this_should_work as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/constify-module-enums-namespace.rs b/tests/expectations/tests/constify-module-enums-namespace.rs index 7f1c134d3c..a15157eb94 100644 --- a/tests/expectations/tests/constify-module-enums-namespace.rs +++ b/tests/expectations/tests/constify-module-enums-namespace.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -41,7 +46,8 @@ pub mod root { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).this_should_work as *const _ as usize + &(*(::std::ptr::null::())).this_should_work + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/constify-module-enums-shadow-name.rs b/tests/expectations/tests/constify-module-enums-shadow-name.rs index 9642871745..636aa6fc61 100644 --- a/tests/expectations/tests/constify-module-enums-shadow-name.rs +++ b/tests/expectations/tests/constify-module-enums-shadow-name.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod foo { pub type Type = u32; diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs index 70c881b9f4..3a7e1116a9 100644 --- a/tests/expectations/tests/constify-module-enums-simple-alias.rs +++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod Foo { pub type Type = i32; @@ -56,7 +61,9 @@ fn bindgen_test_layout_Bar() { concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz4)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz_ptr1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz_ptr1 as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -66,7 +73,9 @@ fn bindgen_test_layout_Bar() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz_ptr2 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz_ptr2 as *const _ as usize + }, 24usize, concat!( "Offset of field: ", @@ -76,7 +85,9 @@ fn bindgen_test_layout_Bar() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz_ptr3 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz_ptr3 as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -86,7 +97,9 @@ fn bindgen_test_layout_Bar() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz_ptr4 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz_ptr4 as *const _ as usize + }, 40usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs index ee15b57be5..fe58fc8ed1 100644 --- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs +++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod one_Foo { pub type Type = i32; diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs index 155839be7c..bbb6308a6b 100644 --- a/tests/expectations/tests/constify-module-enums-types.rs +++ b/tests/expectations/tests/constify-module-enums-types.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod foo { pub type Type = u32; @@ -28,12 +33,12 @@ pub mod ns2_Foo { pub const Variant1: Type = 0; pub const Variant2: Type = 1; } -pub use self::foo::Type as foo_alias1; -pub use self::foo_alias1 as foo_alias2; -pub use self::foo_alias2 as foo_alias3; pub use self::anon_enum::Type as anon_enum_alias1; pub use self::anon_enum_alias1 as anon_enum_alias2; pub use self::anon_enum_alias2 as anon_enum_alias3; +pub use self::foo::Type as foo_alias1; +pub use self::foo_alias1 as foo_alias2; +pub use self::foo_alias2 as foo_alias3; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bar { @@ -151,7 +156,9 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).member10 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).member10 as *const _ as usize + }, 44usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/constructor-tp.rs b/tests/expectations/tests/constructor-tp.rs index 7336024850..c547206bb5 100644 --- a/tests/expectations/tests/constructor-tp.rs +++ b/tests/expectations/tests/constructor-tp.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/constructors.rs b/tests/expectations/tests/constructors.rs index b20e3f44d5..d8099db55e 100644 --- a/tests/expectations/tests/constructors.rs +++ b/tests/expectations/tests/constructors.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -24,7 +27,10 @@ fn bindgen_test_layout_TestOverload() { } extern "C" { #[link_name = "\u{1}_ZN12TestOverloadC1Ei"] - pub fn TestOverload_TestOverload(this: *mut TestOverload, arg1: ::std::os::raw::c_int); + pub fn TestOverload_TestOverload( + this: *mut TestOverload, + arg1: ::std::os::raw::c_int, + ); } extern "C" { #[link_name = "\u{1}_ZN12TestOverloadC1Ed"] diff --git a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs index 9036b12f18..61730fb66c 100644 --- a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs +++ b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs @@ -77,7 +77,9 @@ fn bindgen_test_layout_Contains() { concat!("Alignment of ", stringify!(Contains)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).empty as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).empty as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs index 8058af1067..ba8359e16e 100644 --- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs +++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_mbedtls_mpi() { concat!("Alignment of ", stringify!(mbedtls_mpi)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).s as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_mbedtls_mpi() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).n as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).n as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -52,7 +56,9 @@ fn bindgen_test_layout_mbedtls_mpi() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).p as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).p as *const _ as usize + }, 16usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs index 325fc267e4..2083b4d2a6 100644 --- a/tests/expectations/tests/convert-floats.rs +++ b/tests/expectations/tests/convert-floats.rs @@ -61,7 +61,9 @@ fn bindgen_test_layout_foo() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).complexFloat as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).complexFloat as *const _ as usize + }, 24usize, concat!( "Offset of field: ", @@ -71,7 +73,9 @@ fn bindgen_test_layout_foo() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).complexDouble as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).complexDouble as *const _ as usize + }, 32usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/cpp-empty-layout.rs b/tests/expectations/tests/cpp-empty-layout.rs index 36cae7222f..f14057bfe6 100644 --- a/tests/expectations/tests/cpp-empty-layout.rs +++ b/tests/expectations/tests/cpp-empty-layout.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/crtp.rs b/tests/expectations/tests/crtp.rs index c56cceb2e8..4e6d7da7fb 100644 --- a/tests/expectations/tests/crtp.rs +++ b/tests/expectations/tests/crtp.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/dash_language.rs b/tests/expectations/tests/dash_language.rs index f6d15d1c24..ed60dcf813 100644 --- a/tests/expectations/tests/dash_language.rs +++ b/tests/expectations/tests/dash_language.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/decl_extern_int_twice.rs b/tests/expectations/tests/decl_extern_int_twice.rs index 04a53e51e5..6cf37251a4 100644 --- a/tests/expectations/tests/decl_extern_int_twice.rs +++ b/tests/expectations/tests/decl_extern_int_twice.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub static mut foo: ::std::os::raw::c_int; diff --git a/tests/expectations/tests/decl_ptr_to_array.rs b/tests/expectations/tests/decl_ptr_to_array.rs index 0750bbbbcf..fc6184d54a 100644 --- a/tests/expectations/tests/decl_ptr_to_array.rs +++ b/tests/expectations/tests/decl_ptr_to_array.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub static mut foo: *mut [::std::os::raw::c_int; 1usize]; diff --git a/tests/expectations/tests/default-template-parameter.rs b/tests/expectations/tests/default-template-parameter.rs index 8d4ba3dd4f..b4388fe2d0 100644 --- a/tests/expectations/tests/default-template-parameter.rs +++ b/tests/expectations/tests/default-template-parameter.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs index abe57781a5..b86b807abd 100644 --- a/tests/expectations/tests/derive-bitfield-method-same-name.rs +++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -146,7 +152,11 @@ impl ::std::fmt::Debug for Foo { self.large .iter() .enumerate() - .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v)) + .map(|(i, v)| format!( + "{}{:?}", + if i > 0 { ", " } else { "" }, + v + )) .collect::(), self.type__bindgen_bitfield() ) @@ -154,14 +164,16 @@ impl ::std::fmt::Debug for Foo { } impl ::std::cmp::PartialEq for Foo { fn eq(&self, other: &Foo) -> bool { - &self.large[..] == &other.large[..] - && self.type__bindgen_bitfield() == other.type__bindgen_bitfield() + &self.large[..] == &other.large[..] && + self.type__bindgen_bitfield() == other.type__bindgen_bitfield() } } impl Foo { #[inline] pub fn type__bindgen_bitfield(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) + } } #[inline] pub fn set_type__bindgen_bitfield(&mut self, val: ::std::os::raw::c_char) { @@ -174,8 +186,10 @@ impl Foo { pub fn new_bitfield_1( type__bindgen_bitfield: ::std::os::raw::c_char, ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { let type__bindgen_bitfield: u8 = unsafe { ::std::mem::transmute(type__bindgen_bitfield) }; diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs index 62042ffc21..3d19fda129 100644 --- a/tests/expectations/tests/derive-clone.rs +++ b/tests/expectations/tests/derive-clone.rs @@ -26,7 +26,10 @@ fn bindgen_test_layout_ShouldDeriveClone() { concat!("Alignment of ", stringify!(ShouldDeriveClone)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs index c2fafe8fc5..7fd60b1a71 100644 --- a/tests/expectations/tests/derive-clone_1_0.rs +++ b/tests/expectations/tests/derive-clone_1_0.rs @@ -27,7 +27,10 @@ fn bindgen_test_layout_ShouldImplClone() { concat!("Alignment of ", stringify!(ShouldImplClone)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs index 882bb9d632..b0a006e65d 100644 --- a/tests/expectations/tests/derive-debug-bitfield-core.rs +++ b/tests/expectations/tests/derive-debug-bitfield-core.rs @@ -59,7 +59,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -77,7 +80,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -109,7 +115,9 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { &(*(::core::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::())).large_array as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -137,7 +145,9 @@ impl ::core::fmt::Debug for C { impl C { #[inline] pub fn a(&self) -> bool { - unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_a(&mut self, val: bool) { @@ -148,7 +158,9 @@ impl C { } #[inline] pub fn b(&self) -> bool { - unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } + unsafe { + ::core::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) + } } #[inline] pub fn set_b(&mut self, val: bool) { @@ -158,9 +170,14 @@ impl C { } } #[inline] - pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + a: bool, + b: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u8 = unsafe { ::core::mem::transmute(a) }; a as u64 diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs index d72dd98772..945824485d 100644 --- a/tests/expectations/tests/derive-debug-bitfield.rs +++ b/tests/expectations/tests/derive-debug-bitfield.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -107,7 +113,9 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large_array as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -132,7 +140,11 @@ impl ::std::fmt::Debug for C { self.large_array .iter() .enumerate() - .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v)) + .map(|(i, v)| format!( + "{}{:?}", + if i > 0 { ", " } else { "" }, + v + )) .collect::() ) } @@ -140,7 +152,9 @@ impl ::std::fmt::Debug for C { impl C { #[inline] pub fn a(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_a(&mut self, val: bool) { @@ -151,7 +165,9 @@ impl C { } #[inline] pub fn b(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) + } } #[inline] pub fn set_b(&mut self, val: bool) { @@ -161,9 +177,14 @@ impl C { } } #[inline] - pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + a: bool, + b: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u8 = unsafe { ::std::mem::transmute(a) }; a as u64 diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs index 237fa1d48a..7915fb66fc 100644 --- a/tests/expectations/tests/derive-debug-function-pointer.rs +++ b/tests/expectations/tests/derive-debug-function-pointer.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Copy, Clone)] @@ -10,7 +13,8 @@ pub struct Nice { pub pointer: Nice_Function, pub large_array: [::std::os::raw::c_int; 34usize], } -pub type Nice_Function = ::std::option::Option; +pub type Nice_Function = + ::std::option::Option; #[test] fn bindgen_test_layout_Nice() { assert_eq!( @@ -24,7 +28,9 @@ fn bindgen_test_layout_Nice() { concat!("Alignment of ", stringify!(Nice)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pointer as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pointer as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -34,7 +40,9 @@ fn bindgen_test_layout_Nice() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large_array as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -58,7 +66,11 @@ impl ::std::fmt::Debug for Nice { self.large_array .iter() .enumerate() - .map(|(i, v)| format!("{}{:?}", if i > 0 { ", " } else { "" }, v)) + .map(|(i, v)| format!( + "{}{:?}", + if i > 0 { ", " } else { "" }, + v + )) .collect::() ) } diff --git a/tests/expectations/tests/derive-debug-generic.rs b/tests/expectations/tests/derive-debug-generic.rs index c793cb8a89..40cc99a58d 100644 --- a/tests/expectations/tests/derive-debug-generic.rs +++ b/tests/expectations/tests/derive-debug-generic.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct Generic { diff --git a/tests/expectations/tests/derive-debug-mangle-name.rs b/tests/expectations/tests/derive-debug-mangle-name.rs index 9c72fbbd1e..e9ea16e440 100644 --- a/tests/expectations/tests/derive-debug-mangle-name.rs +++ b/tests/expectations/tests/derive-debug-mangle-name.rs @@ -34,7 +34,10 @@ fn bindgen_test_layout_perf_event_attr__bindgen_ty_1() { concat!("Alignment of ", stringify!(perf_event_attr__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -44,7 +47,10 @@ fn bindgen_test_layout_perf_event_attr__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -77,7 +83,10 @@ fn bindgen_test_layout_perf_event_attr() { concat!("Alignment of ", stringify!(perf_event_attr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -87,7 +96,9 @@ fn bindgen_test_layout_perf_event_attr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs index 605ce78fb5..d00b65ef49 100644 --- a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs +++ b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct Instance { @@ -21,7 +24,9 @@ fn bindgen_test_layout_Instance() { concat!("Alignment of ", stringify!(Instance)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).val as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).val as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-opaque.rs b/tests/expectations/tests/derive-debug-opaque.rs index bc7d9fd6be..a1747fcc8c 100644 --- a/tests/expectations/tests/derive-debug-opaque.rs +++ b/tests/expectations/tests/derive-debug-opaque.rs @@ -52,7 +52,9 @@ fn bindgen_test_layout_OpaqueUser() { concat!("Alignment of ", stringify!(OpaqueUser)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).opaque as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).opaque as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-default-and-blacklist.rs b/tests/expectations/tests/derive-default-and-blacklist.rs index 1520aa3cf3..0087dd508a 100644 --- a/tests/expectations/tests/derive-default-and-blacklist.rs +++ b/tests/expectations/tests/derive-default-and-blacklist.rs @@ -28,7 +28,10 @@ fn bindgen_test_layout_ShouldNotDeriveDefault() { concat!("Alignment of ", stringify!(ShouldNotDeriveDefault)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs index 7f158b3bc9..6ea28a0219 100644 --- a/tests/expectations/tests/derive-fn-ptr.rs +++ b/tests/expectations/tests/derive-fn-ptr.rs @@ -45,7 +45,9 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).callback as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).callback as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +91,9 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).callback as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).callback as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-and-blacklist.rs b/tests/expectations/tests/derive-hash-and-blacklist.rs index 92e918ca88..51a792f106 100644 --- a/tests/expectations/tests/derive-hash-and-blacklist.rs +++ b/tests/expectations/tests/derive-hash-and-blacklist.rs @@ -27,7 +27,10 @@ fn bindgen_test_layout_ShouldNotDeriveHash() { concat!("Alignment of ", stringify!(ShouldNotDeriveHash)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-blacklisting.rs b/tests/expectations/tests/derive-hash-blacklisting.rs index f64db06231..8b696e9269 100644 --- a/tests/expectations/tests/derive-hash-blacklisting.rs +++ b/tests/expectations/tests/derive-hash-blacklisting.rs @@ -33,7 +33,9 @@ fn bindgen_test_layout_WhitelistedOne() { concat!("Alignment of ", stringify!(WhitelistedOne)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -66,7 +68,9 @@ fn bindgen_test_layout_WhitelistedTwo() { concat!("Alignment of ", stringify!(WhitelistedTwo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs index c31595323f..3e0693b8dc 100644 --- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs +++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs index a38fd27db4..d2e60d27fc 100644 --- a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs @@ -67,7 +67,10 @@ fn bindgen_test_layout_test() { concat!("Offset of field: ", stringify!(test), "::", stringify!(a)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).zero_length_array as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).zero_length_array as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs index c0b14b020a..28d3105e58 100644 --- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs +++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs @@ -26,7 +26,9 @@ fn bindgen_test_layout_ConstPtrMutObj() { concat!("Alignment of ", stringify!(ConstPtrMutObj)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -59,7 +61,9 @@ fn bindgen_test_layout_MutPtrMutObj() { concat!("Alignment of ", stringify!(MutPtrMutObj)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -92,7 +96,9 @@ fn bindgen_test_layout_MutPtrConstObj() { concat!("Alignment of ", stringify!(MutPtrConstObj)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -125,7 +131,10 @@ fn bindgen_test_layout_ConstPtrConstObj() { concat!("Alignment of ", stringify!(ConstPtrConstObj)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bar as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-and-blacklist.rs b/tests/expectations/tests/derive-partialeq-and-blacklist.rs index 01fdc07922..2026e5ad31 100644 --- a/tests/expectations/tests/derive-partialeq-and-blacklist.rs +++ b/tests/expectations/tests/derive-partialeq-and-blacklist.rs @@ -28,7 +28,10 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs index ed92813b5d..b6c38c0fa1 100644 --- a/tests/expectations/tests/derive-partialeq-base.rs +++ b/tests/expectations/tests/derive-partialeq-base.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Copy, Clone)] diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs index c183fc0f84..808afc05c8 100644 --- a/tests/expectations/tests/derive-partialeq-bitfield.rs +++ b/tests/expectations/tests/derive-partialeq-bitfield.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -107,7 +113,9 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large_array as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -124,15 +132,17 @@ impl Default for C { } impl ::std::cmp::PartialEq for C { fn eq(&self, other: &C) -> bool { - self.a() == other.a() - && self.b() == other.b() - && &self.large_array[..] == &other.large_array[..] + self.a() == other.a() && + self.b() == other.b() && + &self.large_array[..] == &other.large_array[..] } } impl C { #[inline] pub fn a(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_a(&mut self, val: bool) { @@ -143,7 +153,9 @@ impl C { } #[inline] pub fn b(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) + } } #[inline] pub fn set_b(&mut self, val: bool) { @@ -153,9 +165,14 @@ impl C { } } #[inline] - pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + a: bool, + b: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u8 = unsafe { ::std::mem::transmute(a) }; a as u64 diff --git a/tests/expectations/tests/derive-partialeq-core.rs b/tests/expectations/tests/derive-partialeq-core.rs index 7d6f35719a..8cf4b4a13c 100644 --- a/tests/expectations/tests/derive-partialeq-core.rs +++ b/tests/expectations/tests/derive-partialeq-core.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern crate core; @@ -23,7 +27,9 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { &(*(::core::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::())).large_array as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs index a271f41032..f91ce1242b 100644 --- a/tests/expectations/tests/derive-partialeq-union.rs +++ b/tests/expectations/tests/derive-partialeq-union.rs @@ -28,7 +28,10 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +41,10 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-union_1_0.rs b/tests/expectations/tests/derive-partialeq-union_1_0.rs index 41a42dd72a..7739088cb0 100644 --- a/tests/expectations/tests/derive-partialeq-union_1_0.rs +++ b/tests/expectations/tests/derive-partialeq-union_1_0.rs @@ -71,7 +71,10 @@ fn bindgen_test_layout_ShouldDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldDerivePartialEq)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -81,7 +84,10 @@ fn bindgen_test_layout_ShouldDerivePartialEq() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/disable-namespacing.rs b/tests/expectations/tests/disable-namespacing.rs index b369a22dfd..0ef47c0ea4 100644 --- a/tests/expectations/tests/disable-namespacing.rs +++ b/tests/expectations/tests/disable-namespacing.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type Baz = ::std::os::raw::c_int; diff --git a/tests/expectations/tests/divide-by-zero-in-struct-layout.rs b/tests/expectations/tests/divide-by-zero-in-struct-layout.rs index fcfa962bdc..77ccce3da4 100644 --- a/tests/expectations/tests/divide-by-zero-in-struct-layout.rs +++ b/tests/expectations/tests/divide-by-zero-in-struct-layout.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -98,8 +104,10 @@ pub struct WithBitfield { impl WithBitfield { #[inline] pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 0usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 0usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 0usize], + u8, + > = Default::default(); __bindgen_bitfield_unit } } @@ -113,8 +121,10 @@ pub struct WithBitfieldAndAttrPacked { impl WithBitfieldAndAttrPacked { #[inline] pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 0usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 0usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 0usize], + u8, + > = Default::default(); __bindgen_bitfield_unit } } @@ -128,8 +138,10 @@ pub struct WithBitfieldAndPacked { impl WithBitfieldAndPacked { #[inline] pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 0usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 0usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 0usize], + u8, + > = Default::default(); __bindgen_bitfield_unit } } diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs index 50fcebd415..c7a384d081 100644 --- a/tests/expectations/tests/do-not-derive-copy.rs +++ b/tests/expectations/tests/do-not-derive-copy.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] @@ -26,7 +29,8 @@ fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).x as *const _ as usize + &(*(::std::ptr::null::())).x + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs index fff400c2b8..8a377151fd 100644 --- a/tests/expectations/tests/duplicated-namespaces-definitions.rs +++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -30,14 +33,28 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(foo) + ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz as *const _ as usize + }, 4usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(baz) + ) ); } } @@ -62,9 +79,16 @@ pub mod root { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ptr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ptr as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Foo), "::", stringify!(ptr)) + concat!( + "Offset of field: ", + stringify!(Foo), + "::", + stringify!(ptr) + ) ); } impl Default for Foo { diff --git a/tests/expectations/tests/duplicated-namespaces.rs b/tests/expectations/tests/duplicated-namespaces.rs index a5f2caacca..d44dac5d75 100644 --- a/tests/expectations/tests/duplicated-namespaces.rs +++ b/tests/expectations/tests/duplicated-namespaces.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/duplicated_constants_in_ns.rs b/tests/expectations/tests/duplicated_constants_in_ns.rs index c3f1adde49..f616eaad1a 100644 --- a/tests/expectations/tests/duplicated_constants_in_ns.rs +++ b/tests/expectations/tests/duplicated_constants_in_ns.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/elaborated.rs b/tests/expectations/tests/elaborated.rs index f68b55af0d..def5e7c468 100644 --- a/tests/expectations/tests/elaborated.rs +++ b/tests/expectations/tests/elaborated.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type whatever_whatever_t = ::std::os::raw::c_int; extern "C" { diff --git a/tests/expectations/tests/empty-enum.rs b/tests/expectations/tests/empty-enum.rs index 473a508ad4..06f24422b3 100644 --- a/tests/expectations/tests/empty-enum.rs +++ b/tests/expectations/tests/empty-enum.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type EmptyConstified = u32; #[repr(u32)] diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs index 30289ce48a..b80a983ba1 100644 --- a/tests/expectations/tests/empty_template_param_name.rs +++ b/tests/expectations/tests/empty_template_param_name.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type __void_t = ::std::os::raw::c_void; #[repr(C)] diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs index 6ced4de085..c2ef65026b 100644 --- a/tests/expectations/tests/enum-default-consts.rs +++ b/tests/expectations/tests/enum-default-consts.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const Foo_Bar: Foo = 0; pub const Foo_Qux: Foo = 1; diff --git a/tests/expectations/tests/enum-default-module.rs b/tests/expectations/tests/enum-default-module.rs index 953793c378..1ed4338fcf 100644 --- a/tests/expectations/tests/enum-default-module.rs +++ b/tests/expectations/tests/enum-default-module.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod Foo { pub type Type = u32; diff --git a/tests/expectations/tests/enum-default-rust.rs b/tests/expectations/tests/enum-default-rust.rs index 1400e37395..6c65832476 100644 --- a/tests/expectations/tests/enum-default-rust.rs +++ b/tests/expectations/tests/enum-default-rust.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/enum-undefault.rs b/tests/expectations/tests/enum-undefault.rs index b5d56c4244..11d4162287 100644 --- a/tests/expectations/tests/enum-undefault.rs +++ b/tests/expectations/tests/enum-undefault.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/enum_alias.rs b/tests/expectations/tests/enum_alias.rs index 30a4f62a8d..2996177981 100644 --- a/tests/expectations/tests/enum_alias.rs +++ b/tests/expectations/tests/enum_alias.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u8)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs index 76e28aaf70..8d2cf204e8 100644 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_; pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else; diff --git a/tests/expectations/tests/enum_explicit_type.rs b/tests/expectations/tests/enum_explicit_type.rs index a5ec4a57b7..fee19153a0 100644 --- a/tests/expectations/tests/enum_explicit_type.rs +++ b/tests/expectations/tests/enum_explicit_type.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u8)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/enum_explicit_type_constants.rs b/tests/expectations/tests/enum_explicit_type_constants.rs index cd1a922903..c15849f37f 100644 --- a/tests/expectations/tests/enum_explicit_type_constants.rs +++ b/tests/expectations/tests/enum_explicit_type_constants.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const Foo_Bar: Foo = 0; pub const Foo_Qux: Foo = 1; diff --git a/tests/expectations/tests/enum_negative.rs b/tests/expectations/tests/enum_negative.rs index e066968db4..4824c5d579 100644 --- a/tests/expectations/tests/enum_negative.rs +++ b/tests/expectations/tests/enum_negative.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/enum_packed.rs b/tests/expectations/tests/enum_packed.rs index d388b5edc0..a1514ab254 100644 --- a/tests/expectations/tests/enum_packed.rs +++ b/tests/expectations/tests/enum_packed.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u8)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/eval-variadic-template-parameter.rs b/tests/expectations/tests/eval-variadic-template-parameter.rs index 1386396f46..8f6f8981df 100644 --- a/tests/expectations/tests/eval-variadic-template-parameter.rs +++ b/tests/expectations/tests/eval-variadic-template-parameter.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/extern-const-struct.rs b/tests/expectations/tests/extern-const-struct.rs index df81311b7b..51e9f97096 100644 --- a/tests/expectations/tests/extern-const-struct.rs +++ b/tests/expectations/tests/extern-const-struct.rs @@ -25,7 +25,9 @@ fn bindgen_test_layout_nsFoo() { concat!("Alignment of ", stringify!(nsFoo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).details as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).details as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/extern.rs b/tests/expectations/tests/extern.rs index e257b7bca4..af01e955c2 100644 --- a/tests/expectations/tests/extern.rs +++ b/tests/expectations/tests/extern.rs @@ -1,10 +1,12 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type foo = ::std::option::Option< - unsafe extern "C" fn(bar: ::std::os::raw::c_int) - -> ::std::os::raw::c_int, + unsafe extern "C" fn(bar: ::std::os::raw::c_int) -> ::std::os::raw::c_int, >; diff --git a/tests/expectations/tests/float128.rs b/tests/expectations/tests/float128.rs index 5dcc6c4008..d6776794e9 100644 --- a/tests/expectations/tests/float128.rs +++ b/tests/expectations/tests/float128.rs @@ -1,4 +1,8 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs index 5d3c3eaafb..8501ce97ac 100644 --- a/tests/expectations/tests/forward-declaration-autoptr.rs +++ b/tests/expectations/tests/forward-declaration-autoptr.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -36,7 +41,9 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).m_member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).m_member as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/forward-enum-decl.rs b/tests/expectations/tests/forward-enum-decl.rs index d327cb725b..90666f4b1c 100644 --- a/tests/expectations/tests/forward-enum-decl.rs +++ b/tests/expectations/tests/forward-enum-decl.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs index 19772dbe06..0135896482 100644 --- a/tests/expectations/tests/forward-inherit-struct-with-fields.rs +++ b/tests/expectations/tests/forward-inherit-struct-with-fields.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/forward-inherit-struct.rs b/tests/expectations/tests/forward-inherit-struct.rs index a2399bcb7c..e39c8669a6 100644 --- a/tests/expectations/tests/forward-inherit-struct.rs +++ b/tests/expectations/tests/forward-inherit-struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs index 1132bfbe89..3175b8a901 100644 --- a/tests/expectations/tests/forward_declared_complex_types.rs +++ b/tests/expectations/tests/forward_declared_complex_types.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs index c69960b829..a595422628 100644 --- a/tests/expectations/tests/forward_declared_struct.rs +++ b/tests/expectations/tests/forward_declared_struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/func_proto.rs b/tests/expectations/tests/func_proto.rs index e257b7bca4..af01e955c2 100644 --- a/tests/expectations/tests/func_proto.rs +++ b/tests/expectations/tests/func_proto.rs @@ -1,10 +1,12 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type foo = ::std::option::Option< - unsafe extern "C" fn(bar: ::std::os::raw::c_int) - -> ::std::os::raw::c_int, + unsafe extern "C" fn(bar: ::std::os::raw::c_int) -> ::std::os::raw::c_int, >; diff --git a/tests/expectations/tests/func_ptr.rs b/tests/expectations/tests/func_ptr.rs index 0f39a07579..ce89a2e6f8 100644 --- a/tests/expectations/tests/func_ptr.rs +++ b/tests/expectations/tests/func_ptr.rs @@ -1,13 +1,17 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { - pub static mut foo: - ::std::option::Option< - unsafe extern "C" fn(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) - -> ::std::os::raw::c_int, + pub static mut foo: ::std::option::Option< + unsafe extern "C" fn( + x: ::std::os::raw::c_int, + y: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, >; } diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs index f23984e825..60b8029d4a 100644 --- a/tests/expectations/tests/func_ptr_in_struct.rs +++ b/tests/expectations/tests/func_ptr_in_struct.rs @@ -16,7 +16,10 @@ pub enum baz { #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Foo { pub bar: ::std::option::Option< - unsafe extern "C" fn(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) -> baz, + unsafe extern "C" fn( + x: ::std::os::raw::c_int, + y: ::std::os::raw::c_int, + ) -> baz, >, } #[test] diff --git a/tests/expectations/tests/func_ptr_return_type.rs b/tests/expectations/tests/func_ptr_return_type.rs index 3a2c90019b..0ce7809c25 100644 --- a/tests/expectations/tests/func_ptr_return_type.rs +++ b/tests/expectations/tests/func_ptr_return_type.rs @@ -15,4 +15,3 @@ extern "C" { ) -> ::std::os::raw::c_int, >; } - diff --git a/tests/expectations/tests/func_with_array_arg.rs b/tests/expectations/tests/func_with_array_arg.rs index ec5617dcc7..e03cb82e4d 100644 --- a/tests/expectations/tests/func_with_array_arg.rs +++ b/tests/expectations/tests/func_with_array_arg.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn f(x: *mut ::std::os::raw::c_int); diff --git a/tests/expectations/tests/func_with_func_ptr_arg.rs b/tests/expectations/tests/func_with_func_ptr_arg.rs index 3cb821026c..8d94b715bb 100644 --- a/tests/expectations/tests/func_with_func_ptr_arg.rs +++ b/tests/expectations/tests/func_with_func_ptr_arg.rs @@ -13,10 +13,16 @@ extern "C" { extern "C" { pub fn bar( one: ::std::option::Option< - unsafe extern "C" fn(a: ::std::os::raw::c_int, b: ::std::os::raw::c_int), + unsafe extern "C" fn( + a: ::std::os::raw::c_int, + b: ::std::os::raw::c_int, + ), >, two: ::std::option::Option< - unsafe extern "C" fn(c: ::std::os::raw::c_int, d: ::std::os::raw::c_int), + unsafe extern "C" fn( + c: ::std::os::raw::c_int, + d: ::std::os::raw::c_int, + ), >, ); } diff --git a/tests/expectations/tests/gen-constructors-neg.rs b/tests/expectations/tests/gen-constructors-neg.rs index 36cae7222f..f14057bfe6 100644 --- a/tests/expectations/tests/gen-constructors-neg.rs +++ b/tests/expectations/tests/gen-constructors-neg.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/gen-constructors.rs b/tests/expectations/tests/gen-constructors.rs index cb2024a16b..4f94845060 100644 --- a/tests/expectations/tests/gen-constructors.rs +++ b/tests/expectations/tests/gen-constructors.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs index 37740e0970..552ad41e8d 100644 --- a/tests/expectations/tests/gen-destructors-neg.rs +++ b/tests/expectations/tests/gen-destructors-neg.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] diff --git a/tests/expectations/tests/gen-destructors.rs b/tests/expectations/tests/gen-destructors.rs index 03ccec2ae6..1715a9d113 100644 --- a/tests/expectations/tests/gen-destructors.rs +++ b/tests/expectations/tests/gen-destructors.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] diff --git a/tests/expectations/tests/generate-inline.rs b/tests/expectations/tests/generate-inline.rs index 48d8f4f898..4276a3efc5 100644 --- a/tests/expectations/tests/generate-inline.rs +++ b/tests/expectations/tests/generate-inline.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/i128.rs b/tests/expectations/tests/i128.rs index 1fae2bee8c..0d926260bc 100644 --- a/tests/expectations/tests/i128.rs +++ b/tests/expectations/tests/i128.rs @@ -27,7 +27,9 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).my_signed as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).my_signed as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -37,7 +39,9 @@ fn bindgen_test_layout_foo() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).my_unsigned as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).my_unsigned as *const _ as usize + }, 16usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/in_class_typedef.rs b/tests/expectations/tests/in_class_typedef.rs index 92a23ad31c..5fb517f3a2 100644 --- a/tests/expectations/tests/in_class_typedef.rs +++ b/tests/expectations/tests/in_class_typedef.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/incomplete-array-padding.rs b/tests/expectations/tests/incomplete-array-padding.rs index 5e96bbce96..b83a6dcb42 100644 --- a/tests/expectations/tests/incomplete-array-padding.rs +++ b/tests/expectations/tests/incomplete-array-padding.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -151,7 +157,9 @@ impl Default for foo { impl foo { #[inline] pub fn a(&self) -> ::std::os::raw::c_char { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_a(&mut self, val: ::std::os::raw::c_char) { @@ -161,9 +169,13 @@ impl foo { } } #[inline] - pub fn new_bitfield_1(a: ::std::os::raw::c_char) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + a: ::std::os::raw::c_char, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u8 = unsafe { ::std::mem::transmute(a) }; a as u64 diff --git a/tests/expectations/tests/infinite-macro.rs b/tests/expectations/tests/infinite-macro.rs index 7c88ce2a52..b1a6646397 100644 --- a/tests/expectations/tests/infinite-macro.rs +++ b/tests/expectations/tests/infinite-macro.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const INFINITY: f64 = ::std::f64::INFINITY; pub const NAN: f64 = ::std::f64::NAN; diff --git a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs index 19200ac1bb..6e118d685f 100644 --- a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs +++ b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs @@ -153,7 +153,8 @@ fn __bindgen_test_layout_BaseWithVtable_open0_ptr_char_close0_instantiation() { ); } #[test] -fn __bindgen_test_layout_BaseWithVtable_open0_ptr_char_close0_instantiation_1() { +fn __bindgen_test_layout_BaseWithVtable_open0_ptr_char_close0_instantiation_1() +{ assert_eq!( ::std::mem::size_of::>(), 16usize, @@ -172,7 +173,8 @@ fn __bindgen_test_layout_BaseWithVtable_open0_ptr_char_close0_instantiation_1() ); } #[test] -fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation() { +fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation() +{ assert_eq!( ::std::mem::size_of::>(), 8usize, @@ -182,7 +184,8 @@ fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation() ) ); assert_eq!( - ::std::mem::align_of::>(), + ::std::mem::align_of::>( + ), 8usize, concat!( "Alignment of template specialization: ", @@ -191,7 +194,8 @@ fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation() ); } #[test] -fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation_1() { +fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation_1( +) { assert_eq!( ::std::mem::size_of::>(), 8usize, @@ -201,7 +205,8 @@ fn __bindgen_test_layout_BaseWithoutVtable_open0_ptr_char_close0_instantiation_1 ) ); assert_eq!( - ::std::mem::align_of::>(), + ::std::mem::align_of::>( + ), 8usize, concat!( "Alignment of template specialization: ", diff --git a/tests/expectations/tests/inherit-namespaced.rs b/tests/expectations/tests/inherit-namespaced.rs index a2399bcb7c..e39c8669a6 100644 --- a/tests/expectations/tests/inherit-namespaced.rs +++ b/tests/expectations/tests/inherit-namespaced.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/inherit_named.rs b/tests/expectations/tests/inherit_named.rs index fadf270ebf..7c7f729ff6 100644 --- a/tests/expectations/tests/inherit_named.rs +++ b/tests/expectations/tests/inherit_named.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/inherit_typedef.rs b/tests/expectations/tests/inherit_typedef.rs index 49e842d7c6..13eac16b20 100644 --- a/tests/expectations/tests/inherit_typedef.rs +++ b/tests/expectations/tests/inherit_typedef.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/inline-function.rs b/tests/expectations/tests/inline-function.rs index 5dcc6c4008..d6776794e9 100644 --- a/tests/expectations/tests/inline-function.rs +++ b/tests/expectations/tests/inline-function.rs @@ -1,4 +1,8 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs index 910883de4c..b6905c4dd9 100644 --- a/tests/expectations/tests/inline_namespace.rs +++ b/tests/expectations/tests/inline_namespace.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -33,7 +36,12 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(baz) + ) ); } } diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs index 90fc3793e1..bfd48385bc 100644 --- a/tests/expectations/tests/inline_namespace_conservative.rs +++ b/tests/expectations/tests/inline_namespace_conservative.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -38,7 +41,12 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(baz) + ) ); } } diff --git a/tests/expectations/tests/inline_namespace_no_ns_enabled.rs b/tests/expectations/tests/inline_namespace_no_ns_enabled.rs index e208f0dcc6..ac2fa72a5c 100644 --- a/tests/expectations/tests/inline_namespace_no_ns_enabled.rs +++ b/tests/expectations/tests/inline_namespace_no_ns_enabled.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug)] diff --git a/tests/expectations/tests/inline_namespace_whitelist.rs b/tests/expectations/tests/inline_namespace_whitelist.rs index 857a7005fa..e4a471cfe8 100644 --- a/tests/expectations/tests/inline_namespace_whitelist.rs +++ b/tests/expectations/tests/inline_namespace_whitelist.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs index ef62414ee6..c2e7902333 100644 --- a/tests/expectations/tests/inner_const.rs +++ b/tests/expectations/tests/inner_const.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs index 5a975175e8..91666c8afa 100644 --- a/tests/expectations/tests/inner_template_self.rs +++ b/tests/expectations/tests/inner_template_self.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -33,7 +36,10 @@ fn bindgen_test_layout_InstantiateIt() { concat!("Alignment of ", stringify!(InstantiateIt)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).m_list as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).m_list as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/int128_t.rs b/tests/expectations/tests/int128_t.rs index 5dcc6c4008..d6776794e9 100644 --- a/tests/expectations/tests/int128_t.rs +++ b/tests/expectations/tests/int128_t.rs @@ -1,4 +1,8 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] diff --git a/tests/expectations/tests/issue-1025-unknown-enum-repr.rs b/tests/expectations/tests/issue-1025-unknown-enum-repr.rs index 265109106a..b871172724 100644 --- a/tests/expectations/tests/issue-1025-unknown-enum-repr.rs +++ b/tests/expectations/tests/issue-1025-unknown-enum-repr.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-1034.rs b/tests/expectations/tests/issue-1034.rs index 4db46afe0d..1433fab1cb 100644 --- a/tests/expectations/tests/issue-1034.rs +++ b/tests/expectations/tests/issue-1034.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,8 +116,10 @@ fn bindgen_test_layout_S2() { impl S2 { #[inline] pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit } } diff --git a/tests/expectations/tests/issue-1040.rs b/tests/expectations/tests/issue-1040.rs index 3271d0e812..cde27973b9 100644 --- a/tests/expectations/tests/issue-1040.rs +++ b/tests/expectations/tests/issue-1040.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const g_107: ::std::os::raw::c_ulonglong = 18446744073709551615; diff --git a/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs b/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs index eef609a28d..5665b24e20 100644 --- a/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs +++ b/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,8 +116,10 @@ fn bindgen_test_layout_S1() { impl S1 { #[inline] pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit } } diff --git a/tests/expectations/tests/issue-1113-template-references.rs b/tests/expectations/tests/issue-1113-template-references.rs index 3430f27dd7..54c80b3df5 100644 --- a/tests/expectations/tests/issue-1113-template-references.rs +++ b/tests/expectations/tests/issue-1113-template-references.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-1118-using-forward-decl.rs b/tests/expectations/tests/issue-1118-using-forward-decl.rs index d72e08b9eb..580329a5f3 100644 --- a/tests/expectations/tests/issue-1118-using-forward-decl.rs +++ b/tests/expectations/tests/issue-1118-using-forward-decl.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type c = nsTArray; #[repr(C)] @@ -23,7 +26,9 @@ fn bindgen_test_layout_nsTArray_base() { concat!("Alignment of ", stringify!(nsTArray_base)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).d as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -66,7 +71,9 @@ fn bindgen_test_layout_nsIContent() { concat!("Alignment of ", stringify!(nsIContent)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -102,7 +109,8 @@ fn __bindgen_test_layout_nsTArray_open0_ptr_nsIContent_close0_instantiation() { ); } #[test] -fn __bindgen_test_layout_nsTArray_open0_ptr_nsIContent_close0_instantiation_1() { +fn __bindgen_test_layout_nsTArray_open0_ptr_nsIContent_close0_instantiation_1() +{ assert_eq!( ::std::mem::size_of::(), 8usize, diff --git a/tests/expectations/tests/issue-1197-pure-virtual-stuff.rs b/tests/expectations/tests/issue-1197-pure-virtual-stuff.rs index a3c5f4f602..1c1baa5919 100644 --- a/tests/expectations/tests/issue-1197-pure-virtual-stuff.rs +++ b/tests/expectations/tests/issue-1197-pure-virtual-stuff.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct Foo__bindgen_vtable(::std::os::raw::c_void); diff --git a/tests/expectations/tests/issue-1198-alias-rust-const-mod-bitfield-enum.rs b/tests/expectations/tests/issue-1198-alias-rust-const-mod-bitfield-enum.rs index ed53fdf9ed..888636a11d 100644 --- a/tests/expectations/tests/issue-1198-alias-rust-const-mod-bitfield-enum.rs +++ b/tests/expectations/tests/issue-1198-alias-rust-const-mod-bitfield-enum.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod MyDupeEnum { pub type Type = u32; diff --git a/tests/expectations/tests/issue-1198-alias-rust-const-mod-enum.rs b/tests/expectations/tests/issue-1198-alias-rust-const-mod-enum.rs index ed53fdf9ed..888636a11d 100644 --- a/tests/expectations/tests/issue-1198-alias-rust-const-mod-enum.rs +++ b/tests/expectations/tests/issue-1198-alias-rust-const-mod-enum.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub mod MyDupeEnum { pub type Type = u32; diff --git a/tests/expectations/tests/issue-1238-fwd-no-copy.rs b/tests/expectations/tests/issue-1238-fwd-no-copy.rs index f2156dfb5a..061e39ea54 100644 --- a/tests/expectations/tests/issue-1238-fwd-no-copy.rs +++ b/tests/expectations/tests/issue-1238-fwd-no-copy.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug)] diff --git a/tests/expectations/tests/issue-1281.rs b/tests/expectations/tests/issue-1281.rs index cfc8ca40c1..d56d6361cf 100644 --- a/tests/expectations/tests/issue-1281.rs +++ b/tests/expectations/tests/issue-1281.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-1285.rs b/tests/expectations/tests/issue-1285.rs index d0328d340e..b630c54c30 100644 --- a/tests/expectations/tests/issue-1285.rs +++ b/tests/expectations/tests/issue-1285.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1291.rs b/tests/expectations/tests/issue-1291.rs index f92d364e30..6416691741 100644 --- a/tests/expectations/tests/issue-1291.rs +++ b/tests/expectations/tests/issue-1291.rs @@ -51,7 +51,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).align0 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).align0 as *const _ as usize + }, 12usize, concat!( "Offset of field: ", @@ -71,7 +73,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).align1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).align1 as *const _ as usize + }, 28usize, concat!( "Offset of field: ", @@ -81,7 +85,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tnear as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tnear as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -131,7 +137,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).align2 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).align2 as *const _ as usize + }, 60usize, concat!( "Offset of field: ", @@ -151,7 +159,9 @@ fn bindgen_test_layout_RTCRay() { concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(v)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).geomID as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).geomID as *const _ as usize + }, 72usize, concat!( "Offset of field: ", @@ -161,7 +171,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).primID as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).primID as *const _ as usize + }, 76usize, concat!( "Offset of field: ", @@ -171,7 +183,9 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).instID as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).instID as *const _ as usize + }, 80usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1498.rs b/tests/expectations/tests/issue-1498.rs index 0f9ef68031..5dbf0bf5cd 100644 --- a/tests/expectations/tests/issue-1498.rs +++ b/tests/expectations/tests/issue-1498.rs @@ -46,7 +46,10 @@ fn bindgen_test_layout_rte_memseg__bindgen_ty_1() { concat!("Alignment of ", stringify!(rte_memseg__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).addr + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -57,7 +60,8 @@ fn bindgen_test_layout_rte_memseg__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).addr_64 as *const _ as usize + &(*(::std::ptr::null::())).addr_64 + as *const _ as usize }, 0usize, concat!( @@ -86,7 +90,10 @@ fn bindgen_test_layout_rte_memseg() { concat!("Alignment of ", stringify!(rte_memseg)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).phys_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).phys_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -96,7 +103,9 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).len as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -106,7 +115,10 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hugepage_sz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hugepage_sz as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -116,7 +128,10 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).socket_id as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).socket_id as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -126,7 +141,9 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nchannel as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nchannel as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -136,7 +153,9 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nrank as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nrank as *const _ as usize + }, 40usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1554.rs b/tests/expectations/tests/issue-1554.rs index c3fb0d4863..d302997913 100644 --- a/tests/expectations/tests/issue-1554.rs +++ b/tests/expectations/tests/issue-1554.rs @@ -9,7 +9,6 @@ #![cfg(feature = "nightly")] #![feature(non_exhaustive)] - #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/issue-358.rs b/tests/expectations/tests/issue-358.rs index 892148aa7d..19624c5176 100644 --- a/tests/expectations/tests/issue-358.rs +++ b/tests/expectations/tests/issue-358.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs index a146573bb4..ff9a7d046e 100644 --- a/tests/expectations/tests/issue-372.rs +++ b/tests/expectations/tests/issue-372.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/issue-410.rs b/tests/expectations/tests/issue-410.rs index e1ce9df549..26ebcc3c78 100644 --- a/tests/expectations/tests/issue-410.rs +++ b/tests/expectations/tests/issue-410.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/issue-446.rs b/tests/expectations/tests/issue-446.rs index d5634d53a6..e4f1b2a793 100644 --- a/tests/expectations/tests/issue-446.rs +++ b/tests/expectations/tests/issue-446.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-447.rs b/tests/expectations/tests/issue-447.rs index 11a99ad142..0d9eac805e 100644 --- a/tests/expectations/tests/issue-447.rs +++ b/tests/expectations/tests/issue-447.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -61,7 +64,9 @@ pub mod root { } impl JSAutoCompartment { #[inline] - pub unsafe fn new(arg1: root::mozilla::detail::GuardObjectNotifier) -> Self { + pub unsafe fn new( + arg1: root::mozilla::detail::GuardObjectNotifier, + ) -> Self { let mut __bindgen_tmp = ::std::mem::uninitialized(); JSAutoCompartment_JSAutoCompartment(&mut __bindgen_tmp, arg1); __bindgen_tmp diff --git a/tests/expectations/tests/issue-537-repr-packed-n.rs b/tests/expectations/tests/issue-537-repr-packed-n.rs index 1c930a8b98..6ec9a2d96a 100644 --- a/tests/expectations/tests/issue-537-repr-packed-n.rs +++ b/tests/expectations/tests/issue-537-repr-packed-n.rs @@ -28,7 +28,9 @@ fn bindgen_test_layout_AlignedToOne() { concat!("Alignment of ", stringify!(AlignedToOne)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -57,7 +59,9 @@ fn bindgen_test_layout_AlignedToTwo() { concat!("Alignment of ", stringify!(AlignedToTwo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +93,9 @@ fn bindgen_test_layout_PackedToOne() { concat!("Alignment of ", stringify!(PackedToOne)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -99,7 +105,9 @@ fn bindgen_test_layout_PackedToOne() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -129,7 +137,9 @@ fn bindgen_test_layout_PackedToTwo() { concat!("Alignment of ", stringify!(PackedToTwo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -139,7 +149,9 @@ fn bindgen_test_layout_PackedToTwo() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-537.rs b/tests/expectations/tests/issue-537.rs index aaaa9f195e..1081f7abb4 100644 --- a/tests/expectations/tests/issue-537.rs +++ b/tests/expectations/tests/issue-537.rs @@ -27,7 +27,9 @@ fn bindgen_test_layout_AlignedToOne() { concat!("Alignment of ", stringify!(AlignedToOne)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -57,7 +59,9 @@ fn bindgen_test_layout_AlignedToTwo() { concat!("Alignment of ", stringify!(AlignedToTwo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +93,9 @@ fn bindgen_test_layout_PackedToOne() { concat!("Alignment of ", stringify!(PackedToOne)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -99,7 +105,9 @@ fn bindgen_test_layout_PackedToOne() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -131,7 +139,9 @@ fn bindgen_test_layout_PackedToTwo() { concat!("Alignment of ", stringify!(PackedToTwo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -141,7 +151,9 @@ fn bindgen_test_layout_PackedToTwo() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-544-stylo-creduce-2.rs b/tests/expectations/tests/issue-544-stylo-creduce-2.rs index 071111a453..8d708ad672 100644 --- a/tests/expectations/tests/issue-544-stylo-creduce-2.rs +++ b/tests/expectations/tests/issue-544-stylo-creduce-2.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct Foo { diff --git a/tests/expectations/tests/issue-544-stylo-creduce.rs b/tests/expectations/tests/issue-544-stylo-creduce.rs index fbee3b2556..7c4cd7e19a 100644 --- a/tests/expectations/tests/issue-544-stylo-creduce.rs +++ b/tests/expectations/tests/issue-544-stylo-creduce.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs index 1119b7e76a..18ecc73ed8 100644 --- a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs +++ b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const ENUM_VARIANT_1: _bindgen_ty_1 = _bindgen_ty_1::ENUM_VARIANT_1; pub const ENUM_VARIANT_2: _bindgen_ty_1 = _bindgen_ty_1::ENUM_VARIANT_2; diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs index cbb08bb2fe..0dfac5189f 100644 --- a/tests/expectations/tests/issue-573-layout-test-failures.rs +++ b/tests/expectations/tests/issue-573-layout-test-failures.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -27,7 +30,9 @@ fn bindgen_test_layout_AutoIdVector() { concat!("Alignment of ", stringify!(AutoIdVector)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index 21d381a721..e1087f63dd 100644 --- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -27,7 +30,9 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_bindgen_ty_1>())).ar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::<_bindgen_ty_1>())).ar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs index a7d085b0e2..42cb8659b9 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type RefPtr = T; diff --git a/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs index 11571a2d6c..0d846f4d2c 100644 --- a/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-639-typedef-anon-field.rs b/tests/expectations/tests/issue-639-typedef-anon-field.rs index 3cc21b19f0..3494e1f129 100644 --- a/tests/expectations/tests/issue-639-typedef-anon-field.rs +++ b/tests/expectations/tests/issue-639-typedef-anon-field.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-643-inner-struct.rs b/tests/expectations/tests/issue-643-inner-struct.rs index e9384c078a..167dab3d07 100644 --- a/tests/expectations/tests/issue-643-inner-struct.rs +++ b/tests/expectations/tests/issue-643-inner-struct.rs @@ -69,7 +69,10 @@ fn bindgen_test_layout_rte_ring_prod() { concat!("Alignment of ", stringify!(rte_ring_prod)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).watermark as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).watermark as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -97,7 +100,10 @@ fn bindgen_test_layout_rte_ring_cons() { concat!("Alignment of ", stringify!(rte_ring_cons)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sc_dequeue as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).sc_dequeue as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs b/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs index 4d65c0aec5..e34d0425d9 100644 --- a/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[derive(Clone, Copy, Debug)] pub struct RefPtr(T); diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs index 15f0209410..cb5ce74e65 100644 --- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs +++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs @@ -76,7 +76,10 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { concat!("Alignment of ", stringify!(ShouldDeriveDebugButDoesNot)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -86,7 +89,10 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).d + as *const _ as usize + }, 32usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-654-struct-fn-collision.rs b/tests/expectations/tests/issue-654-struct-fn-collision.rs index fbd8cca3ec..1f34e8ae8d 100644 --- a/tests/expectations/tests/issue-654-struct-fn-collision.rs +++ b/tests/expectations/tests/issue-654-struct-fn-collision.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs b/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs index f5ecbd5e2d..19e4ce3cd7 100644 --- a/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-662-part-2.rs b/tests/expectations/tests/issue-662-part-2.rs index 9e685b3add..7b79057838 100644 --- a/tests/expectations/tests/issue-662-part-2.rs +++ b/tests/expectations/tests/issue-662-part-2.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[derive(Clone, Copy, Debug)] pub struct RefPtr(T); diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs index 0186549434..cb76b7764c 100644 --- a/tests/expectations/tests/issue-674-1.rs +++ b/tests/expectations/tests/issue-674-1.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -36,7 +39,10 @@ pub mod root { concat!("Alignment of ", stringify!(CapturingContentInfo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs index 9394708db7..a6a37d9bfe 100644 --- a/tests/expectations/tests/issue-674-2.rs +++ b/tests/expectations/tests/issue-674-2.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs index 413ad9269a..c4b25649b4 100644 --- a/tests/expectations/tests/issue-674-3.rs +++ b/tests/expectations/tests/issue-674-3.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -55,7 +58,9 @@ pub mod root { concat!("Alignment of ", stringify!(nsCSSValue)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-677-nested-ns-specifier.rs b/tests/expectations/tests/issue-677-nested-ns-specifier.rs index c3fb04061d..2f1b904f0e 100644 --- a/tests/expectations/tests/issue-677-nested-ns-specifier.rs +++ b/tests/expectations/tests/issue-677-nested-ns-specifier.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/issue-691-template-parameter-virtual.rs b/tests/expectations/tests/issue-691-template-parameter-virtual.rs index 4878c1fadf..afe5b75d29 100644 --- a/tests/expectations/tests/issue-691-template-parameter-virtual.rs +++ b/tests/expectations/tests/issue-691-template-parameter-virtual.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct VirtualMethods__bindgen_vtable(::std::os::raw::c_void); diff --git a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs index 213b6812da..48298a6f5d 100644 --- a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs +++ b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,7 +116,9 @@ fn bindgen_test_layout_Foo() { impl Foo { #[inline] pub fn m_bitfield(&self) -> ::std::os::raw::c_ulong { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 64u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 64u8) as u64) + } } #[inline] pub fn set_m_bitfield(&mut self, val: ::std::os::raw::c_ulong) { @@ -121,7 +129,9 @@ impl Foo { } #[inline] pub fn m_bar(&self) -> ::std::os::raw::c_ulong { - unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 64u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(64usize, 64u8) as u64) + } } #[inline] pub fn set_m_bar(&mut self, val: ::std::os::raw::c_ulong) { @@ -132,7 +142,9 @@ impl Foo { } #[inline] pub fn foo(&self) -> ::std::os::raw::c_ulong { - unsafe { ::std::mem::transmute(self._bitfield_1.get(128usize, 1u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(128usize, 1u8) as u64) + } } #[inline] pub fn set_foo(&mut self, val: ::std::os::raw::c_ulong) { @@ -143,7 +155,9 @@ impl Foo { } #[inline] pub fn bar(&self) -> ::std::os::raw::c_ulong { - unsafe { ::std::mem::transmute(self._bitfield_1.get(192usize, 64u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(192usize, 64u8) as u64) + } } #[inline] pub fn set_bar(&mut self, val: ::std::os::raw::c_ulong) { @@ -159,8 +173,10 @@ impl Foo { foo: ::std::os::raw::c_ulong, bar: ::std::os::raw::c_ulong, ) -> __BindgenBitfieldUnit<[u8; 32usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 32usize], u64> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 32usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 64u8, { let m_bitfield: u64 = unsafe { ::std::mem::transmute(m_bitfield) }; m_bitfield as u64 diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs index 798a9f8fab..1dee1aa14e 100644 --- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs +++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs @@ -122,7 +122,10 @@ fn bindgen_test_layout_Whitelisted() { concat!("Alignment of ", stringify!(Whitelisted)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).some_member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).some_member as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-816.rs b/tests/expectations/tests/issue-816.rs index e55bbb8ca0..82b1d676c8 100644 --- a/tests/expectations/tests/issue-816.rs +++ b/tests/expectations/tests/issue-816.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -110,7 +116,9 @@ fn bindgen_test_layout_capabilities() { impl capabilities { #[inline] pub fn bit_1(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) + } } #[inline] pub fn set_bit_1(&mut self, val: ::std::os::raw::c_uint) { @@ -121,7 +129,9 @@ impl capabilities { } #[inline] pub fn bit_2(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) + } } #[inline] pub fn set_bit_2(&mut self, val: ::std::os::raw::c_uint) { @@ -132,7 +142,9 @@ impl capabilities { } #[inline] pub fn bit_3(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) + } } #[inline] pub fn set_bit_3(&mut self, val: ::std::os::raw::c_uint) { @@ -143,7 +155,9 @@ impl capabilities { } #[inline] pub fn bit_4(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) + } } #[inline] pub fn set_bit_4(&mut self, val: ::std::os::raw::c_uint) { @@ -154,7 +168,9 @@ impl capabilities { } #[inline] pub fn bit_5(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) + } } #[inline] pub fn set_bit_5(&mut self, val: ::std::os::raw::c_uint) { @@ -165,7 +181,9 @@ impl capabilities { } #[inline] pub fn bit_6(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) + } } #[inline] pub fn set_bit_6(&mut self, val: ::std::os::raw::c_uint) { @@ -176,7 +194,9 @@ impl capabilities { } #[inline] pub fn bit_7(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) + } } #[inline] pub fn set_bit_7(&mut self, val: ::std::os::raw::c_uint) { @@ -187,7 +207,9 @@ impl capabilities { } #[inline] pub fn bit_8(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) + } } #[inline] pub fn set_bit_8(&mut self, val: ::std::os::raw::c_uint) { @@ -198,7 +220,9 @@ impl capabilities { } #[inline] pub fn bit_9(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) + } } #[inline] pub fn set_bit_9(&mut self, val: ::std::os::raw::c_uint) { @@ -209,7 +233,9 @@ impl capabilities { } #[inline] pub fn bit_10(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) + } } #[inline] pub fn set_bit_10(&mut self, val: ::std::os::raw::c_uint) { @@ -220,7 +246,9 @@ impl capabilities { } #[inline] pub fn bit_11(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) + } } #[inline] pub fn set_bit_11(&mut self, val: ::std::os::raw::c_uint) { @@ -231,7 +259,9 @@ impl capabilities { } #[inline] pub fn bit_12(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) + } } #[inline] pub fn set_bit_12(&mut self, val: ::std::os::raw::c_uint) { @@ -242,7 +272,9 @@ impl capabilities { } #[inline] pub fn bit_13(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) + } } #[inline] pub fn set_bit_13(&mut self, val: ::std::os::raw::c_uint) { @@ -253,7 +285,9 @@ impl capabilities { } #[inline] pub fn bit_14(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) + } } #[inline] pub fn set_bit_14(&mut self, val: ::std::os::raw::c_uint) { @@ -264,7 +298,9 @@ impl capabilities { } #[inline] pub fn bit_15(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) + } } #[inline] pub fn set_bit_15(&mut self, val: ::std::os::raw::c_uint) { @@ -275,7 +311,9 @@ impl capabilities { } #[inline] pub fn bit_16(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) + } } #[inline] pub fn set_bit_16(&mut self, val: ::std::os::raw::c_uint) { @@ -286,7 +324,9 @@ impl capabilities { } #[inline] pub fn bit_17(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) + } } #[inline] pub fn set_bit_17(&mut self, val: ::std::os::raw::c_uint) { @@ -297,7 +337,9 @@ impl capabilities { } #[inline] pub fn bit_18(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) + } } #[inline] pub fn set_bit_18(&mut self, val: ::std::os::raw::c_uint) { @@ -308,7 +350,9 @@ impl capabilities { } #[inline] pub fn bit_19(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) + } } #[inline] pub fn set_bit_19(&mut self, val: ::std::os::raw::c_uint) { @@ -319,7 +363,9 @@ impl capabilities { } #[inline] pub fn bit_20(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u32) + } } #[inline] pub fn set_bit_20(&mut self, val: ::std::os::raw::c_uint) { @@ -330,7 +376,9 @@ impl capabilities { } #[inline] pub fn bit_21(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) + } } #[inline] pub fn set_bit_21(&mut self, val: ::std::os::raw::c_uint) { @@ -341,7 +389,9 @@ impl capabilities { } #[inline] pub fn bit_22(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) + } } #[inline] pub fn set_bit_22(&mut self, val: ::std::os::raw::c_uint) { @@ -352,7 +402,9 @@ impl capabilities { } #[inline] pub fn bit_23(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) + } } #[inline] pub fn set_bit_23(&mut self, val: ::std::os::raw::c_uint) { @@ -363,7 +415,9 @@ impl capabilities { } #[inline] pub fn bit_24(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u32) + } } #[inline] pub fn set_bit_24(&mut self, val: ::std::os::raw::c_uint) { @@ -374,7 +428,9 @@ impl capabilities { } #[inline] pub fn bit_25(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u32) + } } #[inline] pub fn set_bit_25(&mut self, val: ::std::os::raw::c_uint) { @@ -385,7 +441,9 @@ impl capabilities { } #[inline] pub fn bit_26(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u32) + } } #[inline] pub fn set_bit_26(&mut self, val: ::std::os::raw::c_uint) { @@ -396,7 +454,9 @@ impl capabilities { } #[inline] pub fn bit_27(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u32) + } } #[inline] pub fn set_bit_27(&mut self, val: ::std::os::raw::c_uint) { @@ -407,7 +467,9 @@ impl capabilities { } #[inline] pub fn bit_28(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u32) + } } #[inline] pub fn set_bit_28(&mut self, val: ::std::os::raw::c_uint) { @@ -418,7 +480,9 @@ impl capabilities { } #[inline] pub fn bit_29(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u32) + } } #[inline] pub fn set_bit_29(&mut self, val: ::std::os::raw::c_uint) { @@ -429,7 +493,9 @@ impl capabilities { } #[inline] pub fn bit_30(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u32) + } } #[inline] pub fn set_bit_30(&mut self, val: ::std::os::raw::c_uint) { @@ -440,7 +506,9 @@ impl capabilities { } #[inline] pub fn bit_31(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u32) + } } #[inline] pub fn set_bit_31(&mut self, val: ::std::os::raw::c_uint) { @@ -451,7 +519,9 @@ impl capabilities { } #[inline] pub fn bit_32(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u32) + } } #[inline] pub fn set_bit_32(&mut self, val: ::std::os::raw::c_uint) { @@ -462,7 +532,9 @@ impl capabilities { } #[inline] pub fn bit_33(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u32) + } } #[inline] pub fn set_bit_33(&mut self, val: ::std::os::raw::c_uint) { @@ -473,7 +545,9 @@ impl capabilities { } #[inline] pub fn bit_34(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(33usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(33usize, 1u8) as u32) + } } #[inline] pub fn set_bit_34(&mut self, val: ::std::os::raw::c_uint) { @@ -484,7 +558,9 @@ impl capabilities { } #[inline] pub fn bit_35(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(34usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(34usize, 1u8) as u32) + } } #[inline] pub fn set_bit_35(&mut self, val: ::std::os::raw::c_uint) { @@ -495,7 +571,9 @@ impl capabilities { } #[inline] pub fn bit_36(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(35usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(35usize, 1u8) as u32) + } } #[inline] pub fn set_bit_36(&mut self, val: ::std::os::raw::c_uint) { @@ -506,7 +584,9 @@ impl capabilities { } #[inline] pub fn bit_37(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(36usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(36usize, 1u8) as u32) + } } #[inline] pub fn set_bit_37(&mut self, val: ::std::os::raw::c_uint) { @@ -517,7 +597,9 @@ impl capabilities { } #[inline] pub fn bit_38(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(37usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(37usize, 1u8) as u32) + } } #[inline] pub fn set_bit_38(&mut self, val: ::std::os::raw::c_uint) { @@ -528,7 +610,9 @@ impl capabilities { } #[inline] pub fn bit_39(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(38usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(38usize, 1u8) as u32) + } } #[inline] pub fn set_bit_39(&mut self, val: ::std::os::raw::c_uint) { @@ -539,7 +623,9 @@ impl capabilities { } #[inline] pub fn bit_40(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(39usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(39usize, 1u8) as u32) + } } #[inline] pub fn set_bit_40(&mut self, val: ::std::os::raw::c_uint) { @@ -550,7 +636,9 @@ impl capabilities { } #[inline] pub fn bit_41(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(40usize, 1u8) as u32) + } } #[inline] pub fn set_bit_41(&mut self, val: ::std::os::raw::c_uint) { @@ -603,8 +691,10 @@ impl capabilities { bit_40: ::std::os::raw::c_uint, bit_41: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 16usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 16usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let bit_1: u32 = unsafe { ::std::mem::transmute(bit_1) }; bit_1 as u64 diff --git a/tests/expectations/tests/issue-820-unused-template-param-in-alias.rs b/tests/expectations/tests/issue-820-unused-template-param-in-alias.rs index 23ef513f4a..3abfb89dba 100644 --- a/tests/expectations/tests/issue-820-unused-template-param-in-alias.rs +++ b/tests/expectations/tests/issue-820-unused-template-param-in-alias.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type Foo_self_type = u8; diff --git a/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs b/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs index 36cae7222f..f14057bfe6 100644 --- a/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs +++ b/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-833-1.rs b/tests/expectations/tests/issue-833-1.rs index aa19dd1bd9..da5ae240d6 100644 --- a/tests/expectations/tests/issue-833-1.rs +++ b/tests/expectations/tests/issue-833-1.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct nsTArray { diff --git a/tests/expectations/tests/issue-833-2.rs b/tests/expectations/tests/issue-833-2.rs index c77f59236e..42630af227 100644 --- a/tests/expectations/tests/issue-833-2.rs +++ b/tests/expectations/tests/issue-833-2.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] // If the output of this changes, please ensure issue-833-1.hpp changes too diff --git a/tests/expectations/tests/issue-833.rs b/tests/expectations/tests/issue-833.rs index 4ee4602ab9..e2ee6ad35b 100644 --- a/tests/expectations/tests/issue-833.rs +++ b/tests/expectations/tests/issue-833.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct nsTArray { diff --git a/tests/expectations/tests/issue-834.rs b/tests/expectations/tests/issue-834.rs index a8014fb92e..03e0d44ecc 100644 --- a/tests/expectations/tests/issue-834.rs +++ b/tests/expectations/tests/issue-834.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs index df48ae24a5..35085a8da5 100644 --- a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs +++ b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs b/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs index 5ca34ebb46..985ad446b9 100644 --- a/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs +++ b/tests/expectations/tests/issue-944-derive-copy-and-blacklisting.rs @@ -27,7 +27,9 @@ fn bindgen_test_layout_ShouldNotBeCopy() { concat!("Alignment of ", stringify!(ShouldNotBeCopy)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-946.rs b/tests/expectations/tests/issue-946.rs index 14ed38c65d..48d5e2d0be 100644 --- a/tests/expectations/tests/issue-946.rs +++ b/tests/expectations/tests/issue-946.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/issue_311.rs b/tests/expectations/tests/issue_311.rs index b857537895..67ab8e5249 100644 --- a/tests/expectations/tests/issue_311.rs +++ b/tests/expectations/tests/issue_311.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs index a2e8044748..b07a8af4b9 100644 --- a/tests/expectations/tests/jsval_layout_opaque.rs +++ b/tests/expectations/tests/jsval_layout_opaque.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -213,7 +219,9 @@ impl Default for jsval_layout__bindgen_ty_1 { impl jsval_layout__bindgen_ty_1 { #[inline] pub fn payload47(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 47u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 47u8) as u64) + } } #[inline] pub fn set_payload47(&mut self, val: u64) { @@ -224,7 +232,9 @@ impl jsval_layout__bindgen_ty_1 { } #[inline] pub fn tag(&self) -> JSValueTag { - unsafe { ::std::mem::transmute(self._bitfield_1.get(47usize, 17u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(47usize, 17u8) as u32) + } } #[inline] pub fn set_tag(&mut self, val: JSValueTag) { @@ -238,8 +248,10 @@ impl jsval_layout__bindgen_ty_1 { payload47: u64, tag: JSValueTag, ) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u64> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 47u8, { let payload47: u64 = unsafe { ::std::mem::transmute(payload47) }; payload47 as u64 @@ -284,8 +296,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).i32 as *const _ - as usize + &(*(::std::ptr::null::())) + .i32 as *const _ as usize }, 0usize, concat!( @@ -297,8 +309,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).u32 as *const _ - as usize + &(*(::std::ptr::null::())) + .u32 as *const _ as usize }, 0usize, concat!( @@ -310,8 +322,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).why as *const _ - as usize + &(*(::std::ptr::null::())) + .why as *const _ as usize }, 0usize, concat!( @@ -341,7 +353,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).payload as *const _ as usize + &(*(::std::ptr::null::())).payload + as *const _ as usize }, 0usize, concat!( @@ -370,7 +383,9 @@ fn bindgen_test_layout_jsval_layout() { concat!("Alignment of ", stringify!(jsval_layout)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asBits as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asBits as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -380,7 +395,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).debugView as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).debugView as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -390,7 +408,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).s as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -400,7 +420,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asDouble as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asDouble as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -410,7 +433,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asPtr as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -420,7 +445,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asWord as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asWord as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -430,7 +457,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asUIntPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asUIntPtr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs index b09d129cf2..30b39d2031 100644 --- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs +++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -261,7 +267,9 @@ impl Default for jsval_layout__bindgen_ty_1 { impl jsval_layout__bindgen_ty_1 { #[inline] pub fn payload47(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 47u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 47u8) as u64) + } } #[inline] pub fn set_payload47(&mut self, val: u64) { @@ -272,7 +280,9 @@ impl jsval_layout__bindgen_ty_1 { } #[inline] pub fn tag(&self) -> JSValueTag { - unsafe { ::std::mem::transmute(self._bitfield_1.get(47usize, 17u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(47usize, 17u8) as u32) + } } #[inline] pub fn set_tag(&mut self, val: JSValueTag) { @@ -286,8 +296,10 @@ impl jsval_layout__bindgen_ty_1 { payload47: u64, tag: JSValueTag, ) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u64> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 47u8, { let payload47: u64 = unsafe { ::std::mem::transmute(payload47) }; payload47 as u64 @@ -332,8 +344,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).i32 as *const _ - as usize + &(*(::std::ptr::null::())) + .i32 as *const _ as usize }, 0usize, concat!( @@ -345,8 +357,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).u32 as *const _ - as usize + &(*(::std::ptr::null::())) + .u32 as *const _ as usize }, 0usize, concat!( @@ -358,8 +370,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).why as *const _ - as usize + &(*(::std::ptr::null::())) + .why as *const _ as usize }, 0usize, concat!( @@ -389,7 +401,8 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).payload as *const _ as usize + &(*(::std::ptr::null::())).payload + as *const _ as usize }, 0usize, concat!( @@ -418,7 +431,9 @@ fn bindgen_test_layout_jsval_layout() { concat!("Alignment of ", stringify!(jsval_layout)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asBits as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asBits as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -428,7 +443,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).debugView as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).debugView as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -438,7 +456,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).s as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -448,7 +468,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asDouble as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asDouble as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -458,7 +481,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asPtr as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -468,7 +493,9 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asWord as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asWord as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -478,7 +505,10 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).asUIntPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).asUIntPtr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs index 35f518f812..db57bb08f7 100644 --- a/tests/expectations/tests/keywords.rs +++ b/tests/expectations/tests/keywords.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub static mut u8: ::std::os::raw::c_int; diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs index 51fa1d1a36..b98ff8b515 100644 --- a/tests/expectations/tests/layout_align.rs +++ b/tests/expectations/tests/layout_align.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -178,7 +184,10 @@ fn bindgen_test_layout_rte_eth_link() { concat!("Alignment of ", stringify!(rte_eth_link)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).link_speed as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).link_speed as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -191,7 +200,9 @@ fn bindgen_test_layout_rte_eth_link() { impl rte_eth_link { #[inline] pub fn link_duplex(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) + } } #[inline] pub fn set_link_duplex(&mut self, val: u16) { @@ -202,7 +213,9 @@ impl rte_eth_link { } #[inline] pub fn link_autoneg(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) + } } #[inline] pub fn set_link_autoneg(&mut self, val: u16) { @@ -213,7 +226,9 @@ impl rte_eth_link { } #[inline] pub fn link_status(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) + } } #[inline] pub fn set_link_status(&mut self, val: u16) { @@ -228,18 +243,23 @@ impl rte_eth_link { link_autoneg: u16, link_status: u16, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { - let link_duplex: u16 = unsafe { ::std::mem::transmute(link_duplex) }; + let link_duplex: u16 = + unsafe { ::std::mem::transmute(link_duplex) }; link_duplex as u64 }); __bindgen_bitfield_unit.set(1usize, 1u8, { - let link_autoneg: u16 = unsafe { ::std::mem::transmute(link_autoneg) }; + let link_autoneg: u16 = + unsafe { ::std::mem::transmute(link_autoneg) }; link_autoneg as u64 }); __bindgen_bitfield_unit.set(2usize, 1u8, { - let link_status: u16 = unsafe { ::std::mem::transmute(link_status) }; + let link_status: u16 = + unsafe { ::std::mem::transmute(link_status) }; link_status as u64 }); __bindgen_bitfield_unit diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs index 28dfd53c9c..b8987d9851 100644 --- a/tests/expectations/tests/layout_arp.rs +++ b/tests/expectations/tests/layout_arp.rs @@ -43,7 +43,10 @@ fn bindgen_test_layout_ether_addr() { concat!("Alignment of ", stringify!(ether_addr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).addr_bytes as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).addr_bytes as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -79,7 +82,9 @@ fn bindgen_test_layout_arp_ipv4() { concat!("Alignment of ", stringify!(arp_ipv4)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_sha as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_sha as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +94,9 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_sip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_sip as *const _ as usize + }, 6usize, concat!( "Offset of field: ", @@ -99,7 +106,9 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_tha as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_tha as *const _ as usize + }, 10usize, concat!( "Offset of field: ", @@ -109,7 +118,9 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_tip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_tip as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -143,7 +154,9 @@ fn bindgen_test_layout_arp_hdr() { concat!("Alignment of ", stringify!(arp_hdr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_hrd as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_hrd as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -153,7 +166,9 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_pro as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_pro as *const _ as usize + }, 2usize, concat!( "Offset of field: ", @@ -163,7 +178,9 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_hln as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_hln as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -173,7 +190,9 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_pln as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_pln as *const _ as usize + }, 5usize, concat!( "Offset of field: ", @@ -183,7 +202,9 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_op as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_op as *const _ as usize + }, 6usize, concat!( "Offset of field: ", @@ -193,7 +214,9 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arp_data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arp_data as *const _ as usize + }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs index 0da08871e7..8ddbbb1f68 100644 --- a/tests/expectations/tests/layout_array.rs +++ b/tests/expectations/tests/layout_array.rs @@ -24,10 +24,12 @@ pub struct rte_mempool { /// it will most likely point to a different type of data structure, and /// will be transparent to the application programmer. /// This function should set mp->pool_data. -pub type rte_mempool_alloc_t = - ::std::option::Option ::std::os::raw::c_int>; +pub type rte_mempool_alloc_t = ::std::option::Option< + unsafe extern "C" fn(mp: *mut rte_mempool) -> ::std::os::raw::c_int, +>; /// Free the opaque private data pointed to by mp->pool_data pointer. -pub type rte_mempool_free_t = ::std::option::Option; +pub type rte_mempool_free_t = + ::std::option::Option; /// Enqueue an object into the external pool. pub type rte_mempool_enqueue_t = ::std::option::Option< unsafe extern "C" fn( @@ -45,8 +47,9 @@ pub type rte_mempool_dequeue_t = ::std::option::Option< ) -> ::std::os::raw::c_int, >; /// Return the number of available objects in the external pool. -pub type rte_mempool_get_count = - ::std::option::Option ::std::os::raw::c_uint>; +pub type rte_mempool_get_count = ::std::option::Option< + unsafe extern "C" fn(mp: *const rte_mempool) -> ::std::os::raw::c_uint, +>; /// Structure defining mempool operations structure #[repr(C)] #[repr(align(64))] @@ -79,7 +82,10 @@ fn bindgen_test_layout_rte_mempool_ops() { concat!("Alignment of ", stringify!(rte_mempool_ops)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).name as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -89,7 +95,10 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).alloc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).alloc as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -99,7 +108,10 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).free as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).free as *const _ + as usize + }, 40usize, concat!( "Offset of field: ", @@ -109,7 +121,10 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).enqueue as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).enqueue as *const _ + as usize + }, 48usize, concat!( "Offset of field: ", @@ -119,7 +134,10 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dequeue as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dequeue as *const _ + as usize + }, 56usize, concat!( "Offset of field: ", @@ -129,7 +147,10 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).get_count as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).get_count as *const _ + as usize + }, 64usize, concat!( "Offset of field: ", @@ -146,12 +167,12 @@ impl Default for rte_mempool_ops { } impl ::std::cmp::PartialEq for rte_mempool_ops { fn eq(&self, other: &rte_mempool_ops) -> bool { - self.name == other.name - && self.alloc == other.alloc - && self.free == other.free - && self.enqueue == other.enqueue - && self.dequeue == other.dequeue - && self.get_count == other.get_count + self.name == other.name && + self.alloc == other.alloc && + self.free == other.free && + self.enqueue == other.enqueue && + self.dequeue == other.dequeue && + self.get_count == other.get_count } } /// The rte_spinlock_t type. @@ -174,7 +195,10 @@ fn bindgen_test_layout_rte_spinlock_t() { concat!("Alignment of ", stringify!(rte_spinlock_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).locked as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).locked as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -216,7 +240,10 @@ fn bindgen_test_layout_rte_mempool_ops_table() { concat!("Alignment of ", stringify!(rte_mempool_ops_table)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sl as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).sl as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -226,7 +253,10 @@ fn bindgen_test_layout_rte_mempool_ops_table() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).num_ops as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).num_ops + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -236,7 +266,10 @@ fn bindgen_test_layout_rte_mempool_ops_table() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ops as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ops as *const _ + as usize + }, 64usize, concat!( "Offset of field: ", @@ -280,7 +313,8 @@ fn bindgen_test_layout_malloc_heap__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).lh_first as *const _ as usize + &(*(::std::ptr::null::())).lh_first + as *const _ as usize }, 0usize, concat!( @@ -309,7 +343,9 @@ fn bindgen_test_layout_malloc_heap() { concat!("Alignment of ", stringify!(malloc_heap)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lock as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lock as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -319,7 +355,10 @@ fn bindgen_test_layout_malloc_heap() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).free_head as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).free_head as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -329,7 +368,10 @@ fn bindgen_test_layout_malloc_heap() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).alloc_count as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).alloc_count as *const _ + as usize + }, 112usize, concat!( "Offset of field: ", @@ -339,7 +381,10 @@ fn bindgen_test_layout_malloc_heap() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).total_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).total_size as *const _ + as usize + }, 120usize, concat!( "Offset of field: ", @@ -356,10 +401,10 @@ impl Default for malloc_heap { } impl ::std::cmp::PartialEq for malloc_heap { fn eq(&self, other: &malloc_heap) -> bool { - self.lock == other.lock - && self.free_head == other.free_head - && self.alloc_count == other.alloc_count - && self.total_size == other.total_size + self.lock == other.lock && + self.free_head == other.free_head && + self.alloc_count == other.alloc_count && + self.total_size == other.total_size } } #[repr(C)] diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs index 27dd96ff4c..2cd154afcd 100644 --- a/tests/expectations/tests/layout_array_too_long.rs +++ b/tests/expectations/tests/layout_array_too_long.rs @@ -107,7 +107,9 @@ fn bindgen_test_layout_ip_frag_key() { concat!("Alignment of ", stringify!(ip_frag_key)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_dst as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_dst as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -117,7 +119,9 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).id as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -127,7 +131,9 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).key_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).key_len as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -179,7 +185,8 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tqe_next as *const _ as usize + &(*(::std::ptr::null::())).tqe_next + as *const _ as usize }, 0usize, concat!( @@ -191,7 +198,8 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tqe_prev as *const _ as usize + &(*(::std::ptr::null::())).tqe_prev + as *const _ as usize }, 8usize, concat!( @@ -220,7 +228,9 @@ fn bindgen_test_layout_ip_frag_pkt() { concat!("Alignment of ", stringify!(ip_frag_pkt)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lru as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lru as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -230,7 +240,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).key as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).key as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -240,7 +252,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).start as *const _ as usize + }, 56usize, concat!( "Offset of field: ", @@ -250,7 +264,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).total_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).total_size as *const _ + as usize + }, 64usize, concat!( "Offset of field: ", @@ -260,7 +277,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).frag_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).frag_size as *const _ + as usize + }, 68usize, concat!( "Offset of field: ", @@ -270,7 +290,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).last_idx as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).last_idx as *const _ + as usize + }, 72usize, concat!( "Offset of field: ", @@ -280,7 +303,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).frags as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).frags as *const _ as usize + }, 80usize, concat!( "Offset of field: ", @@ -297,13 +322,13 @@ impl Default for ip_frag_pkt { } impl ::std::cmp::PartialEq for ip_frag_pkt { fn eq(&self, other: &ip_frag_pkt) -> bool { - self.lru == other.lru - && self.key == other.key - && self.start == other.start - && self.total_size == other.total_size - && self.frag_size == other.frag_size - && self.last_idx == other.last_idx - && self.frags == other.frags + self.lru == other.lru && + self.key == other.key && + self.start == other.start && + self.total_size == other.total_size && + self.frag_size == other.frag_size && + self.last_idx == other.last_idx && + self.frags == other.frags } } ///< fragment mbuf diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs index 2ea596fc96..610a3914ac 100644 --- a/tests/expectations/tests/layout_cmdline_token.rs +++ b/tests/expectations/tests/layout_cmdline_token.rs @@ -28,7 +28,10 @@ fn bindgen_test_layout_cmdline_token_hdr() { concat!("Alignment of ", stringify!(cmdline_token_hdr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ops as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ops as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +41,10 @@ fn bindgen_test_layout_cmdline_token_hdr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).offset as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).offset as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -85,7 +91,9 @@ pub struct cmdline_token_ops { >, /// return the num of possible choices for this token pub complete_get_nb: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut cmdline_parse_token_hdr_t) -> ::std::os::raw::c_int, + unsafe extern "C" fn( + arg1: *mut cmdline_parse_token_hdr_t, + ) -> ::std::os::raw::c_int, >, /// return the elt x for this token (token, idx, dstbuf, size) pub complete_get_elt: ::std::option::Option< @@ -118,7 +126,10 @@ fn bindgen_test_layout_cmdline_token_ops() { concat!("Alignment of ", stringify!(cmdline_token_ops)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).parse as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).parse as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -129,7 +140,8 @@ fn bindgen_test_layout_cmdline_token_ops() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).complete_get_nb as *const _ as usize + &(*(::std::ptr::null::())).complete_get_nb + as *const _ as usize }, 8usize, concat!( @@ -141,7 +153,8 @@ fn bindgen_test_layout_cmdline_token_ops() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).complete_get_elt as *const _ as usize + &(*(::std::ptr::null::())).complete_get_elt + as *const _ as usize }, 16usize, concat!( @@ -152,7 +165,10 @@ fn bindgen_test_layout_cmdline_token_ops() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).get_help as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).get_help as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -192,7 +208,10 @@ fn bindgen_test_layout_cmdline_token_num_data() { concat!("Alignment of ", stringify!(cmdline_token_num_data)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -226,7 +245,10 @@ fn bindgen_test_layout_cmdline_token_num() { concat!("Alignment of ", stringify!(cmdline_token_num)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hdr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hdr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -236,7 +258,10 @@ fn bindgen_test_layout_cmdline_token_num() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).num_data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).num_data as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs index d3b22e8122..d10e7740c0 100644 --- a/tests/expectations/tests/layout_eth_conf.rs +++ b/tests/expectations/tests/layout_eth_conf.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -167,7 +173,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { concat!("Alignment of ", stringify!(rte_eth_rxmode)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mq_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mq_mode as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -177,7 +186,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).max_rx_pkt_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).max_rx_pkt_len + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -187,7 +199,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).split_hdr_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).split_hdr_size + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -205,7 +220,9 @@ impl Default for rte_eth_rxmode { impl rte_eth_rxmode { #[inline] pub fn header_split(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) + } } #[inline] pub fn set_header_split(&mut self, val: u16) { @@ -216,7 +233,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_ip_checksum(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) + } } #[inline] pub fn set_hw_ip_checksum(&mut self, val: u16) { @@ -227,7 +246,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_filter(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_filter(&mut self, val: u16) { @@ -238,7 +259,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_strip(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_strip(&mut self, val: u16) { @@ -249,7 +272,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_extend(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_extend(&mut self, val: u16) { @@ -260,7 +285,9 @@ impl rte_eth_rxmode { } #[inline] pub fn jumbo_frame(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) + } } #[inline] pub fn set_jumbo_frame(&mut self, val: u16) { @@ -271,7 +298,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_strip_crc(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) + } } #[inline] pub fn set_hw_strip_crc(&mut self, val: u16) { @@ -282,7 +311,9 @@ impl rte_eth_rxmode { } #[inline] pub fn enable_scatter(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) + } } #[inline] pub fn set_enable_scatter(&mut self, val: u16) { @@ -293,7 +324,9 @@ impl rte_eth_rxmode { } #[inline] pub fn enable_lro(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) + } } #[inline] pub fn set_enable_lro(&mut self, val: u16) { @@ -314,38 +347,48 @@ impl rte_eth_rxmode { enable_scatter: u16, enable_lro: u16, ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { - let header_split: u16 = unsafe { ::std::mem::transmute(header_split) }; + let header_split: u16 = + unsafe { ::std::mem::transmute(header_split) }; header_split as u64 }); __bindgen_bitfield_unit.set(1usize, 1u8, { - let hw_ip_checksum: u16 = unsafe { ::std::mem::transmute(hw_ip_checksum) }; + let hw_ip_checksum: u16 = + unsafe { ::std::mem::transmute(hw_ip_checksum) }; hw_ip_checksum as u64 }); __bindgen_bitfield_unit.set(2usize, 1u8, { - let hw_vlan_filter: u16 = unsafe { ::std::mem::transmute(hw_vlan_filter) }; + let hw_vlan_filter: u16 = + unsafe { ::std::mem::transmute(hw_vlan_filter) }; hw_vlan_filter as u64 }); __bindgen_bitfield_unit.set(3usize, 1u8, { - let hw_vlan_strip: u16 = unsafe { ::std::mem::transmute(hw_vlan_strip) }; + let hw_vlan_strip: u16 = + unsafe { ::std::mem::transmute(hw_vlan_strip) }; hw_vlan_strip as u64 }); __bindgen_bitfield_unit.set(4usize, 1u8, { - let hw_vlan_extend: u16 = unsafe { ::std::mem::transmute(hw_vlan_extend) }; + let hw_vlan_extend: u16 = + unsafe { ::std::mem::transmute(hw_vlan_extend) }; hw_vlan_extend as u64 }); __bindgen_bitfield_unit.set(5usize, 1u8, { - let jumbo_frame: u16 = unsafe { ::std::mem::transmute(jumbo_frame) }; + let jumbo_frame: u16 = + unsafe { ::std::mem::transmute(jumbo_frame) }; jumbo_frame as u64 }); __bindgen_bitfield_unit.set(6usize, 1u8, { - let hw_strip_crc: u16 = unsafe { ::std::mem::transmute(hw_strip_crc) }; + let hw_strip_crc: u16 = + unsafe { ::std::mem::transmute(hw_strip_crc) }; hw_strip_crc as u64 }); __bindgen_bitfield_unit.set(7usize, 1u8, { - let enable_scatter: u16 = unsafe { ::std::mem::transmute(enable_scatter) }; + let enable_scatter: u16 = + unsafe { ::std::mem::transmute(enable_scatter) }; enable_scatter as u64 }); __bindgen_bitfield_unit.set(8usize, 1u8, { @@ -392,7 +435,10 @@ fn bindgen_test_layout_rte_eth_txmode() { concat!("Alignment of ", stringify!(rte_eth_txmode)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mq_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mq_mode as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -402,7 +448,9 @@ fn bindgen_test_layout_rte_eth_txmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pvid as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pvid as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -420,7 +468,9 @@ impl Default for rte_eth_txmode { impl rte_eth_txmode { #[inline] pub fn hw_vlan_reject_tagged(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_reject_tagged(&mut self, val: u8) { @@ -431,7 +481,9 @@ impl rte_eth_txmode { } #[inline] pub fn hw_vlan_reject_untagged(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_reject_untagged(&mut self, val: u8) { @@ -442,7 +494,9 @@ impl rte_eth_txmode { } #[inline] pub fn hw_vlan_insert_pvid(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_insert_pvid(&mut self, val: u8) { @@ -457,10 +511,13 @@ impl rte_eth_txmode { hw_vlan_reject_untagged: u8, hw_vlan_insert_pvid: u8, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { - let hw_vlan_reject_tagged: u8 = unsafe { ::std::mem::transmute(hw_vlan_reject_tagged) }; + let hw_vlan_reject_tagged: u8 = + unsafe { ::std::mem::transmute(hw_vlan_reject_tagged) }; hw_vlan_reject_tagged as u64 }); __bindgen_bitfield_unit.set(1usize, 1u8, { @@ -469,7 +526,8 @@ impl rte_eth_txmode { hw_vlan_reject_untagged as u64 }); __bindgen_bitfield_unit.set(2usize, 1u8, { - let hw_vlan_insert_pvid: u8 = unsafe { ::std::mem::transmute(hw_vlan_insert_pvid) }; + let hw_vlan_insert_pvid: u8 = + unsafe { ::std::mem::transmute(hw_vlan_insert_pvid) }; hw_vlan_insert_pvid as u64 }); __bindgen_bitfield_unit @@ -513,7 +571,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { concat!("Alignment of ", stringify!(rte_eth_rss_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_key as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_key as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -523,7 +584,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_key_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_key_len as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -533,7 +597,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_hf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_hf as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -621,8 +688,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_id as *const _ - as usize + &(*(::std::ptr::null::())) + .vlan_id as *const _ as usize }, 0usize, concat!( @@ -634,8 +701,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).pools as *const _ - as usize + &(*(::std::ptr::null::())) + .pools as *const _ as usize }, 8usize, concat!( @@ -660,7 +727,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -672,8 +740,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_default_pool as *const _ - as usize + &(*(::std::ptr::null::())) + .enable_default_pool as *const _ as usize }, 4usize, concat!( @@ -685,7 +753,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).default_pool as *const _ as usize + &(*(::std::ptr::null::())).default_pool + as *const _ as usize }, 5usize, concat!( @@ -697,7 +766,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_pool_maps as *const _ as usize + &(*(::std::ptr::null::())).nb_pool_maps + as *const _ as usize }, 6usize, concat!( @@ -708,7 +778,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool_map as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool_map + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -718,7 +791,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 1032usize, concat!( "Offset of field: ", @@ -754,7 +830,10 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_tcs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_tcs as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -764,7 +843,10 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -801,7 +883,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -812,7 +895,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -848,7 +934,10 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_tcs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_tcs as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -858,7 +947,10 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -893,7 +985,8 @@ fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -952,8 +1045,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_id as *const _ - as usize + &(*(::std::ptr::null::())) + .vlan_id as *const _ as usize }, 0usize, concat!( @@ -965,8 +1058,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).pools as *const _ - as usize + &(*(::std::ptr::null::())).pools + as *const _ as usize }, 8usize, concat!( @@ -991,7 +1084,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -1003,8 +1097,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_default_pool as *const _ - as usize + &(*(::std::ptr::null::())).enable_default_pool + as *const _ as usize }, 4usize, concat!( @@ -1016,7 +1110,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).default_pool as *const _ as usize + &(*(::std::ptr::null::())).default_pool + as *const _ as usize }, 5usize, concat!( @@ -1028,7 +1123,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_loop_back as *const _ as usize + &(*(::std::ptr::null::())).enable_loop_back + as *const _ as usize }, 6usize, concat!( @@ -1040,7 +1136,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_pool_maps as *const _ as usize + &(*(::std::ptr::null::())).nb_pool_maps + as *const _ as usize }, 7usize, concat!( @@ -1051,7 +1148,10 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_mode as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1061,7 +1161,10 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool_map as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool_map + as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -1142,7 +1245,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv4_flow)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_ip as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -1152,7 +1258,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_ip as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1162,7 +1271,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tos as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tos as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1172,7 +1284,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ttl as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ttl as *const _ + as usize + }, 9usize, concat!( "Offset of field: ", @@ -1182,7 +1297,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).proto as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).proto as *const _ + as usize + }, 10usize, concat!( "Offset of field: ", @@ -1220,7 +1338,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv6_flow)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_ip as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -1230,7 +1351,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_ip as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -1240,7 +1364,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tc as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -1250,7 +1377,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).proto as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).proto as *const _ + as usize + }, 33usize, concat!( "Offset of field: ", @@ -1260,7 +1390,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hop_limits as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hop_limits as *const _ + as usize + }, 34usize, concat!( "Offset of field: ", @@ -1308,7 +1441,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_tci_mask as *const _ as usize + &(*(::std::ptr::null::())).vlan_tci_mask + as *const _ as usize }, 0usize, concat!( @@ -1319,7 +1453,10 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ipv4_mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ipv4_mask as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1329,7 +1466,10 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ipv6_mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ipv6_mask as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -1340,7 +1480,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).src_port_mask as *const _ as usize + &(*(::std::ptr::null::())).src_port_mask + as *const _ as usize }, 52usize, concat!( @@ -1352,7 +1493,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dst_port_mask as *const _ as usize + &(*(::std::ptr::null::())).dst_port_mask + as *const _ as usize }, 54usize, concat!( @@ -1364,7 +1506,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mac_addr_byte_mask as *const _ as usize + &(*(::std::ptr::null::())).mac_addr_byte_mask + as *const _ as usize }, 56usize, concat!( @@ -1376,7 +1519,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tunnel_id_mask as *const _ as usize + &(*(::std::ptr::null::())).tunnel_id_mask + as *const _ as usize }, 60usize, concat!( @@ -1388,7 +1532,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tunnel_type_mask as *const _ as usize + &(*(::std::ptr::null::())).tunnel_type_mask + as *const _ as usize }, 64usize, concat!( @@ -1432,7 +1577,10 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).type_ + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1443,7 +1591,8 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).src_offset as *const _ as usize + &(*(::std::ptr::null::())).src_offset + as *const _ as usize }, 4usize, concat!( @@ -1481,7 +1630,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).flow_type as *const _ as usize + &(*(::std::ptr::null::())).flow_type + as *const _ as usize }, 0usize, concat!( @@ -1492,7 +1642,10 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mask as *const _ + as usize + }, 2usize, concat!( "Offset of field: ", @@ -1528,7 +1681,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_payloads as *const _ as usize + &(*(::std::ptr::null::())).nb_payloads + as *const _ as usize }, 0usize, concat!( @@ -1540,7 +1694,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_flexmasks as *const _ as usize + &(*(::std::ptr::null::())).nb_flexmasks + as *const _ as usize }, 2usize, concat!( @@ -1551,7 +1706,10 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flex_set as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).flex_set + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -1562,7 +1720,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).flex_mask as *const _ as usize + &(*(::std::ptr::null::())).flex_mask + as *const _ as usize }, 292usize, concat!( @@ -1609,7 +1768,9 @@ fn bindgen_test_layout_rte_fdir_conf() { concat!("Alignment of ", stringify!(rte_fdir_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mode as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1619,7 +1780,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pballoc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pballoc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1629,7 +1793,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).status as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1639,7 +1806,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).drop_queue as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).drop_queue as *const _ + as usize + }, 12usize, concat!( "Offset of field: ", @@ -1649,7 +1819,9 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -1659,7 +1831,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flex_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).flex_conf as *const _ + as usize + }, 84usize, concat!( "Offset of field: ", @@ -1696,7 +1871,9 @@ fn bindgen_test_layout_rte_intr_conf() { concat!("Alignment of ", stringify!(rte_intr_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lsc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lsc as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1706,7 +1883,9 @@ fn bindgen_test_layout_rte_intr_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rxq as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rxq as *const _ as usize + }, 2usize, concat!( "Offset of field: ", @@ -1775,7 +1954,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).rss_conf as *const _ as usize + &(*(::std::ptr::null::())).rss_conf + as *const _ as usize }, 0usize, concat!( @@ -1787,8 +1967,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_dcb_conf as *const _ - as usize + &(*(::std::ptr::null::())).vmdq_dcb_conf + as *const _ as usize }, 24usize, concat!( @@ -1800,7 +1980,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dcb_rx_conf as *const _ as usize + &(*(::std::ptr::null::())).dcb_rx_conf + as *const _ as usize }, 1064usize, concat!( @@ -1812,7 +1993,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_rx_conf as *const _ as usize + &(*(::std::ptr::null::())).vmdq_rx_conf + as *const _ as usize }, 1080usize, concat!( @@ -1850,8 +2032,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_dcb_tx_conf as *const _ - as usize + &(*(::std::ptr::null::())) + .vmdq_dcb_tx_conf as *const _ as usize }, 0usize, concat!( @@ -1863,7 +2045,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dcb_tx_conf as *const _ as usize + &(*(::std::ptr::null::())).dcb_tx_conf + as *const _ as usize }, 0usize, concat!( @@ -1875,7 +2058,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_tx_conf as *const _ as usize + &(*(::std::ptr::null::())).vmdq_tx_conf + as *const _ as usize }, 0usize, concat!( @@ -1904,7 +2088,10 @@ fn bindgen_test_layout_rte_eth_conf() { concat!("Alignment of ", stringify!(rte_eth_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).link_speeds as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).link_speeds as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -1914,7 +2101,9 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rxmode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rxmode as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -1924,7 +2113,9 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).txmode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).txmode as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -1934,7 +2125,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lpbk_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lpbk_mode as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -1944,7 +2138,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_adv_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_adv_conf as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -1954,7 +2151,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tx_adv_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tx_adv_conf as *const _ + as usize + }, 2152usize, concat!( "Offset of field: ", @@ -1964,7 +2164,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_capability_en as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_capability_en + as *const _ as usize + }, 2164usize, concat!( "Offset of field: ", @@ -1974,7 +2177,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fdir_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fdir_conf as *const _ + as usize + }, 2168usize, concat!( "Offset of field: ", @@ -1984,7 +2190,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).intr_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).intr_conf as *const _ + as usize + }, 2940usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs index 0234bbd486..9e6d18b28d 100644 --- a/tests/expectations/tests/layout_eth_conf_1_0.rs +++ b/tests/expectations/tests/layout_eth_conf_1_0.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -210,7 +216,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { concat!("Alignment of ", stringify!(rte_eth_rxmode)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mq_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mq_mode as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -220,7 +229,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).max_rx_pkt_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).max_rx_pkt_len + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -230,7 +242,10 @@ fn bindgen_test_layout_rte_eth_rxmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).split_hdr_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).split_hdr_size + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -253,7 +268,9 @@ impl Default for rte_eth_rxmode { impl rte_eth_rxmode { #[inline] pub fn header_split(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) + } } #[inline] pub fn set_header_split(&mut self, val: u16) { @@ -264,7 +281,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_ip_checksum(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) + } } #[inline] pub fn set_hw_ip_checksum(&mut self, val: u16) { @@ -275,7 +294,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_filter(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_filter(&mut self, val: u16) { @@ -286,7 +307,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_strip(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_strip(&mut self, val: u16) { @@ -297,7 +320,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_vlan_extend(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) + } } #[inline] pub fn set_hw_vlan_extend(&mut self, val: u16) { @@ -308,7 +333,9 @@ impl rte_eth_rxmode { } #[inline] pub fn jumbo_frame(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) + } } #[inline] pub fn set_jumbo_frame(&mut self, val: u16) { @@ -319,7 +346,9 @@ impl rte_eth_rxmode { } #[inline] pub fn hw_strip_crc(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) + } } #[inline] pub fn set_hw_strip_crc(&mut self, val: u16) { @@ -330,7 +359,9 @@ impl rte_eth_rxmode { } #[inline] pub fn enable_scatter(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) + } } #[inline] pub fn set_enable_scatter(&mut self, val: u16) { @@ -341,7 +372,9 @@ impl rte_eth_rxmode { } #[inline] pub fn enable_lro(&self) -> u16 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) + } } #[inline] pub fn set_enable_lro(&mut self, val: u16) { @@ -362,38 +395,48 @@ impl rte_eth_rxmode { enable_scatter: u16, enable_lro: u16, ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { - let header_split: u16 = unsafe { ::std::mem::transmute(header_split) }; + let header_split: u16 = + unsafe { ::std::mem::transmute(header_split) }; header_split as u64 }); __bindgen_bitfield_unit.set(1usize, 1u8, { - let hw_ip_checksum: u16 = unsafe { ::std::mem::transmute(hw_ip_checksum) }; + let hw_ip_checksum: u16 = + unsafe { ::std::mem::transmute(hw_ip_checksum) }; hw_ip_checksum as u64 }); __bindgen_bitfield_unit.set(2usize, 1u8, { - let hw_vlan_filter: u16 = unsafe { ::std::mem::transmute(hw_vlan_filter) }; + let hw_vlan_filter: u16 = + unsafe { ::std::mem::transmute(hw_vlan_filter) }; hw_vlan_filter as u64 }); __bindgen_bitfield_unit.set(3usize, 1u8, { - let hw_vlan_strip: u16 = unsafe { ::std::mem::transmute(hw_vlan_strip) }; + let hw_vlan_strip: u16 = + unsafe { ::std::mem::transmute(hw_vlan_strip) }; hw_vlan_strip as u64 }); __bindgen_bitfield_unit.set(4usize, 1u8, { - let hw_vlan_extend: u16 = unsafe { ::std::mem::transmute(hw_vlan_extend) }; + let hw_vlan_extend: u16 = + unsafe { ::std::mem::transmute(hw_vlan_extend) }; hw_vlan_extend as u64 }); __bindgen_bitfield_unit.set(5usize, 1u8, { - let jumbo_frame: u16 = unsafe { ::std::mem::transmute(jumbo_frame) }; + let jumbo_frame: u16 = + unsafe { ::std::mem::transmute(jumbo_frame) }; jumbo_frame as u64 }); __bindgen_bitfield_unit.set(6usize, 1u8, { - let hw_strip_crc: u16 = unsafe { ::std::mem::transmute(hw_strip_crc) }; + let hw_strip_crc: u16 = + unsafe { ::std::mem::transmute(hw_strip_crc) }; hw_strip_crc as u64 }); __bindgen_bitfield_unit.set(7usize, 1u8, { - let enable_scatter: u16 = unsafe { ::std::mem::transmute(enable_scatter) }; + let enable_scatter: u16 = + unsafe { ::std::mem::transmute(enable_scatter) }; enable_scatter as u64 }); __bindgen_bitfield_unit.set(8usize, 1u8, { @@ -440,7 +483,10 @@ fn bindgen_test_layout_rte_eth_txmode() { concat!("Alignment of ", stringify!(rte_eth_txmode)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mq_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mq_mode as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -450,7 +496,9 @@ fn bindgen_test_layout_rte_eth_txmode() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pvid as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pvid as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -473,7 +521,9 @@ impl Default for rte_eth_txmode { impl rte_eth_txmode { #[inline] pub fn hw_vlan_reject_tagged(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_reject_tagged(&mut self, val: u8) { @@ -484,7 +534,9 @@ impl rte_eth_txmode { } #[inline] pub fn hw_vlan_reject_untagged(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_reject_untagged(&mut self, val: u8) { @@ -495,7 +547,9 @@ impl rte_eth_txmode { } #[inline] pub fn hw_vlan_insert_pvid(&self) -> u8 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) + } } #[inline] pub fn set_hw_vlan_insert_pvid(&mut self, val: u8) { @@ -510,10 +564,13 @@ impl rte_eth_txmode { hw_vlan_reject_untagged: u8, hw_vlan_insert_pvid: u8, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { - let hw_vlan_reject_tagged: u8 = unsafe { ::std::mem::transmute(hw_vlan_reject_tagged) }; + let hw_vlan_reject_tagged: u8 = + unsafe { ::std::mem::transmute(hw_vlan_reject_tagged) }; hw_vlan_reject_tagged as u64 }); __bindgen_bitfield_unit.set(1usize, 1u8, { @@ -522,7 +579,8 @@ impl rte_eth_txmode { hw_vlan_reject_untagged as u64 }); __bindgen_bitfield_unit.set(2usize, 1u8, { - let hw_vlan_insert_pvid: u8 = unsafe { ::std::mem::transmute(hw_vlan_insert_pvid) }; + let hw_vlan_insert_pvid: u8 = + unsafe { ::std::mem::transmute(hw_vlan_insert_pvid) }; hw_vlan_insert_pvid as u64 }); __bindgen_bitfield_unit @@ -566,7 +624,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { concat!("Alignment of ", stringify!(rte_eth_rss_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_key as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_key as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -576,7 +637,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_key_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_key_len as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -586,7 +650,10 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss_hf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss_hf as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -679,8 +746,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_id as *const _ - as usize + &(*(::std::ptr::null::())) + .vlan_id as *const _ as usize }, 0usize, concat!( @@ -692,8 +759,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).pools as *const _ - as usize + &(*(::std::ptr::null::())) + .pools as *const _ as usize }, 8usize, concat!( @@ -723,7 +790,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -735,8 +803,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_default_pool as *const _ - as usize + &(*(::std::ptr::null::())) + .enable_default_pool as *const _ as usize }, 4usize, concat!( @@ -748,7 +816,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).default_pool as *const _ as usize + &(*(::std::ptr::null::())).default_pool + as *const _ as usize }, 5usize, concat!( @@ -760,7 +829,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_pool_maps as *const _ as usize + &(*(::std::ptr::null::())).nb_pool_maps + as *const _ as usize }, 6usize, concat!( @@ -771,7 +841,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool_map as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool_map + as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -781,7 +854,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 1032usize, concat!( "Offset of field: ", @@ -822,7 +898,10 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_tcs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_tcs as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -832,7 +911,10 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -874,7 +956,8 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -885,7 +968,10 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -926,7 +1012,10 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_tcs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_tcs as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -936,7 +1025,10 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_tc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -976,7 +1068,8 @@ fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -1040,8 +1133,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_id as *const _ - as usize + &(*(::std::ptr::null::())) + .vlan_id as *const _ as usize }, 0usize, concat!( @@ -1053,8 +1146,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).pools as *const _ - as usize + &(*(::std::ptr::null::())).pools + as *const _ as usize }, 8usize, concat!( @@ -1084,7 +1177,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_queue_pools as *const _ as usize + &(*(::std::ptr::null::())).nb_queue_pools + as *const _ as usize }, 0usize, concat!( @@ -1096,8 +1190,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_default_pool as *const _ - as usize + &(*(::std::ptr::null::())).enable_default_pool + as *const _ as usize }, 4usize, concat!( @@ -1109,7 +1203,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).default_pool as *const _ as usize + &(*(::std::ptr::null::())).default_pool + as *const _ as usize }, 5usize, concat!( @@ -1121,7 +1216,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).enable_loop_back as *const _ as usize + &(*(::std::ptr::null::())).enable_loop_back + as *const _ as usize }, 6usize, concat!( @@ -1133,7 +1229,8 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_pool_maps as *const _ as usize + &(*(::std::ptr::null::())).nb_pool_maps + as *const _ as usize }, 7usize, concat!( @@ -1144,7 +1241,10 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_mode as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1154,7 +1254,10 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool_map as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool_map + as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -1240,7 +1343,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv4_flow)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_ip as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -1250,7 +1356,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_ip as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1260,7 +1369,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tos as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tos as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1270,7 +1382,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ttl as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ttl as *const _ + as usize + }, 9usize, concat!( "Offset of field: ", @@ -1280,7 +1395,10 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).proto as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).proto as *const _ + as usize + }, 10usize, concat!( "Offset of field: ", @@ -1323,7 +1441,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv6_flow)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_ip as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -1333,7 +1454,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dst_ip as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dst_ip as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -1343,7 +1467,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tc as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -1353,7 +1480,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).proto as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).proto as *const _ + as usize + }, 33usize, concat!( "Offset of field: ", @@ -1363,7 +1493,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hop_limits as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hop_limits as *const _ + as usize + }, 34usize, concat!( "Offset of field: ", @@ -1416,7 +1549,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vlan_tci_mask as *const _ as usize + &(*(::std::ptr::null::())).vlan_tci_mask + as *const _ as usize }, 0usize, concat!( @@ -1427,7 +1561,10 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ipv4_mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ipv4_mask as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1437,7 +1574,10 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ipv6_mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ipv6_mask as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -1448,7 +1588,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).src_port_mask as *const _ as usize + &(*(::std::ptr::null::())).src_port_mask + as *const _ as usize }, 52usize, concat!( @@ -1460,7 +1601,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dst_port_mask as *const _ as usize + &(*(::std::ptr::null::())).dst_port_mask + as *const _ as usize }, 54usize, concat!( @@ -1472,7 +1614,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mac_addr_byte_mask as *const _ as usize + &(*(::std::ptr::null::())).mac_addr_byte_mask + as *const _ as usize }, 56usize, concat!( @@ -1484,7 +1627,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tunnel_id_mask as *const _ as usize + &(*(::std::ptr::null::())).tunnel_id_mask + as *const _ as usize }, 60usize, concat!( @@ -1496,7 +1640,8 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tunnel_type_mask as *const _ as usize + &(*(::std::ptr::null::())).tunnel_type_mask + as *const _ as usize }, 64usize, concat!( @@ -1545,7 +1690,10 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).type_ + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1556,7 +1704,8 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).src_offset as *const _ as usize + &(*(::std::ptr::null::())).src_offset + as *const _ as usize }, 4usize, concat!( @@ -1599,7 +1748,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).flow_type as *const _ as usize + &(*(::std::ptr::null::())).flow_type + as *const _ as usize }, 0usize, concat!( @@ -1610,7 +1760,10 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mask as *const _ + as usize + }, 2usize, concat!( "Offset of field: ", @@ -1651,7 +1804,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_payloads as *const _ as usize + &(*(::std::ptr::null::())).nb_payloads + as *const _ as usize }, 0usize, concat!( @@ -1663,7 +1817,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).nb_flexmasks as *const _ as usize + &(*(::std::ptr::null::())).nb_flexmasks + as *const _ as usize }, 2usize, concat!( @@ -1674,7 +1829,10 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flex_set as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).flex_set + as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -1685,7 +1843,8 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).flex_mask as *const _ as usize + &(*(::std::ptr::null::())).flex_mask + as *const _ as usize }, 292usize, concat!( @@ -1737,7 +1896,9 @@ fn bindgen_test_layout_rte_fdir_conf() { concat!("Alignment of ", stringify!(rte_fdir_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mode as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1747,7 +1908,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pballoc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pballoc as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -1757,7 +1921,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).status as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -1767,7 +1934,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).drop_queue as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).drop_queue as *const _ + as usize + }, 12usize, concat!( "Offset of field: ", @@ -1777,7 +1947,9 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mask as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -1787,7 +1959,10 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).flex_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).flex_conf as *const _ + as usize + }, 84usize, concat!( "Offset of field: ", @@ -1829,7 +2004,9 @@ fn bindgen_test_layout_rte_intr_conf() { concat!("Alignment of ", stringify!(rte_intr_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lsc as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lsc as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -1839,7 +2016,9 @@ fn bindgen_test_layout_rte_intr_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rxq as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rxq as *const _ as usize + }, 2usize, concat!( "Offset of field: ", @@ -1913,7 +2092,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).rss_conf as *const _ as usize + &(*(::std::ptr::null::())).rss_conf + as *const _ as usize }, 0usize, concat!( @@ -1925,8 +2105,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_dcb_conf as *const _ - as usize + &(*(::std::ptr::null::())).vmdq_dcb_conf + as *const _ as usize }, 24usize, concat!( @@ -1938,7 +2118,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dcb_rx_conf as *const _ as usize + &(*(::std::ptr::null::())).dcb_rx_conf + as *const _ as usize }, 1064usize, concat!( @@ -1950,7 +2131,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_rx_conf as *const _ as usize + &(*(::std::ptr::null::())).vmdq_rx_conf + as *const _ as usize }, 1080usize, concat!( @@ -1993,8 +2175,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_dcb_tx_conf as *const _ - as usize + &(*(::std::ptr::null::())) + .vmdq_dcb_tx_conf as *const _ as usize }, 0usize, concat!( @@ -2006,7 +2188,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).dcb_tx_conf as *const _ as usize + &(*(::std::ptr::null::())).dcb_tx_conf + as *const _ as usize }, 0usize, concat!( @@ -2018,7 +2201,8 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).vmdq_tx_conf as *const _ as usize + &(*(::std::ptr::null::())).vmdq_tx_conf + as *const _ as usize }, 0usize, concat!( @@ -2047,7 +2231,10 @@ fn bindgen_test_layout_rte_eth_conf() { concat!("Alignment of ", stringify!(rte_eth_conf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).link_speeds as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).link_speeds as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -2057,7 +2244,9 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rxmode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rxmode as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -2067,7 +2256,9 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).txmode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).txmode as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -2077,7 +2268,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lpbk_mode as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lpbk_mode as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -2087,7 +2281,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_adv_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_adv_conf as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -2097,7 +2294,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tx_adv_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tx_adv_conf as *const _ + as usize + }, 2152usize, concat!( "Offset of field: ", @@ -2107,7 +2307,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).dcb_capability_en as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).dcb_capability_en + as *const _ as usize + }, 2164usize, concat!( "Offset of field: ", @@ -2117,7 +2320,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fdir_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fdir_conf as *const _ + as usize + }, 2168usize, concat!( "Offset of field: ", @@ -2127,7 +2333,10 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).intr_conf as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).intr_conf as *const _ + as usize + }, 2940usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs index fd8047aef9..b554aed50b 100644 --- a/tests/expectations/tests/layout_kni_mbuf.rs +++ b/tests/expectations/tests/layout_kni_mbuf.rs @@ -48,7 +48,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { concat!("Alignment of ", stringify!(rte_kni_mbuf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_addr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -58,7 +61,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_physaddr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_physaddr as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -68,7 +74,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad0 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pad0 as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -78,7 +86,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_off as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_off as *const _ + as usize + }, 18usize, concat!( "Offset of field: ", @@ -88,7 +99,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pad1 as *const _ as usize + }, 20usize, concat!( "Offset of field: ", @@ -98,7 +111,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_segs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_segs as *const _ + as usize + }, 22usize, concat!( "Offset of field: ", @@ -108,7 +124,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad4 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pad4 as *const _ as usize + }, 23usize, concat!( "Offset of field: ", @@ -118,7 +136,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ol_flags as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ol_flags as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -128,7 +149,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad2 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pad2 as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -138,7 +161,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pkt_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pkt_len as *const _ + as usize + }, 36usize, concat!( "Offset of field: ", @@ -148,7 +174,10 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_len as *const _ + as usize + }, 40usize, concat!( "Offset of field: ", @@ -158,7 +187,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pad3 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pad3 as *const _ as usize + }, 64usize, concat!( "Offset of field: ", @@ -168,7 +199,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool as *const _ as usize + }, 72usize, concat!( "Offset of field: ", @@ -178,7 +211,9 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).next as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).next as *const _ as usize + }, 80usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs index a02eff58ac..bc6bbe450d 100644 --- a/tests/expectations/tests/layout_large_align_field.rs +++ b/tests/expectations/tests/layout_large_align_field.rs @@ -143,7 +143,9 @@ fn bindgen_test_layout_ip_frag_key() { concat!("Alignment of ", stringify!(ip_frag_key)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).src_dst as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).src_dst as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -153,7 +155,9 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).id as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -163,7 +167,9 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).key_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).key_len as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -215,7 +221,8 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tqe_next as *const _ as usize + &(*(::std::ptr::null::())).tqe_next + as *const _ as usize }, 0usize, concat!( @@ -227,7 +234,8 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tqe_prev as *const _ as usize + &(*(::std::ptr::null::())).tqe_prev + as *const _ as usize }, 8usize, concat!( @@ -256,7 +264,9 @@ fn bindgen_test_layout_ip_frag_pkt() { concat!("Alignment of ", stringify!(ip_frag_pkt)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lru as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lru as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -266,7 +276,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).key as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).key as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -276,7 +288,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).start as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).start as *const _ as usize + }, 56usize, concat!( "Offset of field: ", @@ -286,7 +300,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).total_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).total_size as *const _ + as usize + }, 64usize, concat!( "Offset of field: ", @@ -296,7 +313,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).frag_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).frag_size as *const _ + as usize + }, 68usize, concat!( "Offset of field: ", @@ -306,7 +326,10 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).last_idx as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).last_idx as *const _ + as usize + }, 72usize, concat!( "Offset of field: ", @@ -316,7 +339,9 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).frags as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).frags as *const _ as usize + }, 80usize, concat!( "Offset of field: ", @@ -350,7 +375,10 @@ fn bindgen_test_layout_ip_pkt_list() { concat!("Alignment of ", stringify!(ip_pkt_list)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tqh_first as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tqh_first as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -360,7 +388,10 @@ fn bindgen_test_layout_ip_pkt_list() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).tqh_last as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).tqh_last as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -407,7 +438,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { concat!("Alignment of ", stringify!(ip_frag_tbl_stat)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).find_num as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).find_num as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -417,7 +451,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).add_num as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).add_num as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -427,7 +464,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).del_num as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).del_num as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -437,7 +477,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).reuse_num as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).reuse_num as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -447,7 +490,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fail_total as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fail_total as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -457,7 +503,10 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fail_nospace as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fail_nospace + as *const _ as usize + }, 40usize, concat!( "Offset of field: ", @@ -513,7 +562,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { concat!("Alignment of ", stringify!(rte_ip_frag_tbl)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).max_cycles as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).max_cycles as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -523,7 +575,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).entry_mask as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).entry_mask as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -533,7 +588,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).max_entries as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).max_entries as *const _ + as usize + }, 12usize, concat!( "Offset of field: ", @@ -543,7 +601,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).use_entries as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).use_entries as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -553,7 +614,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bucket_entries as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bucket_entries + as *const _ as usize + }, 20usize, concat!( "Offset of field: ", @@ -563,7 +627,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_entries as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_entries as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -573,7 +640,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_buckets as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_buckets as *const _ + as usize + }, 28usize, concat!( "Offset of field: ", @@ -583,7 +653,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).last as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).last as *const _ + as usize + }, 32usize, concat!( "Offset of field: ", @@ -593,7 +666,9 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).lru as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).lru as *const _ as usize + }, 40usize, concat!( "Offset of field: ", @@ -603,7 +678,10 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).stat as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).stat as *const _ + as usize + }, 64usize, concat!( "Offset of field: ", @@ -613,7 +691,9 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pkt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pkt as *const _ as usize + }, 128usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs index 6f95065dd9..51e5526ec3 100644 --- a/tests/expectations/tests/layout_mbuf.rs +++ b/tests/expectations/tests/layout_mbuf.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -114,7 +120,9 @@ fn bindgen_test_layout_rte_atomic16_t() { concat!("Alignment of ", stringify!(rte_atomic16_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cnt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cnt as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -201,7 +209,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).refcnt_atomic as *const _ as usize + &(*(::std::ptr::null::())).refcnt_atomic + as *const _ as usize }, 0usize, concat!( @@ -212,7 +221,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).refcnt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).refcnt + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -263,7 +275,9 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2__bindgen_ty_1() { impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { #[inline] pub fn l2_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) + } } #[inline] pub fn set_l2_type(&mut self, val: u32) { @@ -274,7 +288,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn l3_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u32) + } } #[inline] pub fn set_l3_type(&mut self, val: u32) { @@ -285,7 +301,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn l4_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) + } } #[inline] pub fn set_l4_type(&mut self, val: u32) { @@ -296,7 +314,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn tun_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) + } } #[inline] pub fn set_tun_type(&mut self, val: u32) { @@ -307,7 +327,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l2_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l2_type(&mut self, val: u32) { @@ -318,7 +340,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l3_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(20usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l3_type(&mut self, val: u32) { @@ -329,7 +353,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l4_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l4_type(&mut self, val: u32) { @@ -348,8 +374,10 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { inner_l3_type: u32, inner_l4_type: u32, ) -> __BindgenBitfieldUnit<[u8; 4usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 4u8, { let l2_type: u32 = unsafe { ::std::mem::transmute(l2_type) }; l2_type as u64 @@ -367,15 +395,18 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { tun_type as u64 }); __bindgen_bitfield_unit.set(16usize, 4u8, { - let inner_l2_type: u32 = unsafe { ::std::mem::transmute(inner_l2_type) }; + let inner_l2_type: u32 = + unsafe { ::std::mem::transmute(inner_l2_type) }; inner_l2_type as u64 }); __bindgen_bitfield_unit.set(20usize, 4u8, { - let inner_l3_type: u32 = unsafe { ::std::mem::transmute(inner_l3_type) }; + let inner_l3_type: u32 = + unsafe { ::std::mem::transmute(inner_l3_type) }; inner_l3_type as u64 }); __bindgen_bitfield_unit.set(24usize, 4u8, { - let inner_l4_type: u32 = unsafe { ::std::mem::transmute(inner_l4_type) }; + let inner_l4_type: u32 = + unsafe { ::std::mem::transmute(inner_l4_type) }; inner_l4_type as u64 }); __bindgen_bitfield_unit @@ -395,7 +426,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).packet_type as *const _ as usize + &(*(::std::ptr::null::())).packet_type + as *const _ as usize }, 0usize, concat!( @@ -433,7 +465,8 @@ pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 { #[repr(C)] #[derive(Copy, Clone)] pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 { - pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, + pub __bindgen_anon_1: + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, pub lo: u32, _bindgen_union_align: u32, } @@ -444,52 +477,18 @@ pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { pub id: u16, } #[test] -fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!( - "Size of: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!( - "Alignment of ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { - & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . hash as * const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(hash) - ) - ); - assert_eq!( - unsafe { - & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . id as * const _ as usize - }, - 2usize, - concat!( - "Offset of field: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(id) - ) - ); +fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1( +) { + assert_eq ! ( :: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) , 4usize , concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) ) ); + assert_eq ! ( :: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) , 2usize , concat ! ( "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) ) ); + assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . hash as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( hash ) ) ); + assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . id as * const _ as usize } , 2usize , concat ! ( "Offset of field: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( id ) ) ); } #[test] fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::( + ), 4usize, concat!( "Size of: ", @@ -497,7 +496,9 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::< + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, + >(), 4usize, concat!( "Alignment of ", @@ -506,8 +507,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).lo - as *const _ as usize + &(*(::std::ptr::null::< + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, + >())) + .lo as *const _ as usize }, 0usize, concat!( @@ -543,7 +546,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).hi as *const _ as usize + &(*(::std::ptr::null::())).hi + as *const _ as usize }, 4usize, concat!( @@ -585,7 +589,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).lo as *const _ as usize + &(*(::std::ptr::null::())).lo + as *const _ as usize }, 0usize, concat!( @@ -597,7 +602,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).hi as *const _ as usize + &(*(::std::ptr::null::())).hi + as *const _ as usize }, 4usize, concat!( @@ -621,7 +627,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -631,7 +640,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fdir as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fdir as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -641,7 +653,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).sched as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -651,7 +666,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).usr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -688,7 +706,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userdata as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).userdata + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -698,7 +719,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).udata64 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).udata64 + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -749,7 +773,9 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5__bindgen_ty_1() { impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { #[inline] pub fn l2_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u64) + } } #[inline] pub fn set_l2_len(&mut self, val: u64) { @@ -760,7 +786,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn l3_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u64) + } } #[inline] pub fn set_l3_len(&mut self, val: u64) { @@ -771,7 +799,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn l4_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u64) + } } #[inline] pub fn set_l4_len(&mut self, val: u64) { @@ -782,7 +812,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn tso_segsz(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 16u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 16u8) as u64) + } } #[inline] pub fn set_tso_segsz(&mut self, val: u64) { @@ -793,7 +825,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn outer_l3_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 9u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(40usize, 9u8) as u64) + } } #[inline] pub fn set_outer_l3_len(&mut self, val: u64) { @@ -804,7 +838,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn outer_l2_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(49usize, 7u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(49usize, 7u8) as u64) + } } #[inline] pub fn set_outer_l2_len(&mut self, val: u64) { @@ -822,8 +858,10 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { outer_l3_len: u64, outer_l2_len: u64, ) -> __BindgenBitfieldUnit<[u8; 8usize], u16> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u16> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u16, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 7u8, { let l2_len: u64 = unsafe { ::std::mem::transmute(l2_len) }; l2_len as u64 @@ -841,11 +879,13 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { tso_segsz as u64 }); __bindgen_bitfield_unit.set(40usize, 9u8, { - let outer_l3_len: u64 = unsafe { ::std::mem::transmute(outer_l3_len) }; + let outer_l3_len: u64 = + unsafe { ::std::mem::transmute(outer_l3_len) }; outer_l3_len as u64 }); __bindgen_bitfield_unit.set(49usize, 7u8, { - let outer_l2_len: u64 = unsafe { ::std::mem::transmute(outer_l2_len) }; + let outer_l2_len: u64 = + unsafe { ::std::mem::transmute(outer_l2_len) }; outer_l2_len as u64 }); __bindgen_bitfield_unit @@ -865,7 +905,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tx_offload as *const _ as usize + &(*(::std::ptr::null::())).tx_offload + as *const _ as usize }, 0usize, concat!( @@ -894,7 +935,9 @@ fn bindgen_test_layout_rte_mbuf() { concat!("Alignment of ", stringify!(rte_mbuf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cacheline0 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cacheline0 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -904,7 +947,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_addr as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -914,7 +959,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_physaddr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_physaddr as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -924,7 +972,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_len as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -934,7 +984,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rearm_data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rearm_data as *const _ as usize + }, 18usize, concat!( "Offset of field: ", @@ -944,7 +996,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_off as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_off as *const _ as usize + }, 18usize, concat!( "Offset of field: ", @@ -954,7 +1008,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_segs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_segs as *const _ as usize + }, 22usize, concat!( "Offset of field: ", @@ -964,7 +1020,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).port as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).port as *const _ as usize + }, 23usize, concat!( "Offset of field: ", @@ -974,7 +1032,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ol_flags as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ol_flags as *const _ as usize + }, 24usize, concat!( "Offset of field: ", @@ -984,7 +1044,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_descriptor_fields1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_descriptor_fields1 + as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -994,7 +1057,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pkt_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pkt_len as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -1004,7 +1069,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_len as *const _ as usize + }, 40usize, concat!( "Offset of field: ", @@ -1014,7 +1081,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vlan_tci as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).vlan_tci as *const _ as usize + }, 42usize, concat!( "Offset of field: ", @@ -1024,7 +1093,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hash as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hash as *const _ as usize + }, 44usize, concat!( "Offset of field: ", @@ -1034,7 +1105,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).seqn as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).seqn as *const _ as usize + }, 52usize, concat!( "Offset of field: ", @@ -1044,7 +1117,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vlan_tci_outer as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).vlan_tci_outer as *const _ + as usize + }, 56usize, concat!( "Offset of field: ", @@ -1054,7 +1130,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cacheline1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cacheline1 as *const _ as usize + }, 64usize, concat!( "Offset of field: ", @@ -1064,7 +1142,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool as *const _ as usize + }, 72usize, concat!( "Offset of field: ", @@ -1074,7 +1154,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).next as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).next as *const _ as usize + }, 80usize, concat!( "Offset of field: ", @@ -1084,7 +1166,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).priv_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).priv_size as *const _ as usize + }, 96usize, concat!( "Offset of field: ", @@ -1094,7 +1178,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).timesync as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).timesync as *const _ as usize + }, 98usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs index b1fb2b9d59..cf05efd315 100644 --- a/tests/expectations/tests/layout_mbuf_1_0.rs +++ b/tests/expectations/tests/layout_mbuf_1_0.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -157,7 +163,9 @@ fn bindgen_test_layout_rte_atomic16_t() { concat!("Alignment of ", stringify!(rte_atomic16_t)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cnt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cnt as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -248,7 +256,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).refcnt_atomic as *const _ as usize + &(*(::std::ptr::null::())).refcnt_atomic + as *const _ as usize }, 0usize, concat!( @@ -259,7 +268,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).refcnt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).refcnt + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -279,7 +291,8 @@ impl Clone for rte_mbuf__bindgen_ty_1 { pub struct rte_mbuf__bindgen_ty_2 { ///< L2/L3/L4 and tunnel information. pub packet_type: __BindgenUnionField, - pub __bindgen_anon_1: __BindgenUnionField, + pub __bindgen_anon_1: + __BindgenUnionField, pub bindgen_union_field: u32, } #[repr(C)] @@ -315,7 +328,9 @@ impl Clone for rte_mbuf__bindgen_ty_2__bindgen_ty_1 { impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { #[inline] pub fn l2_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) + } } #[inline] pub fn set_l2_type(&mut self, val: u32) { @@ -326,7 +341,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn l3_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u32) + } } #[inline] pub fn set_l3_type(&mut self, val: u32) { @@ -337,7 +354,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn l4_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) + } } #[inline] pub fn set_l4_type(&mut self, val: u32) { @@ -348,7 +367,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn tun_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) + } } #[inline] pub fn set_tun_type(&mut self, val: u32) { @@ -359,7 +380,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l2_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l2_type(&mut self, val: u32) { @@ -370,7 +393,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l3_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(20usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l3_type(&mut self, val: u32) { @@ -381,7 +406,9 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { } #[inline] pub fn inner_l4_type(&self) -> u32 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 4u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 4u8) as u32) + } } #[inline] pub fn set_inner_l4_type(&mut self, val: u32) { @@ -400,8 +427,10 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { inner_l3_type: u32, inner_l4_type: u32, ) -> __BindgenBitfieldUnit<[u8; 4usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 4u8, { let l2_type: u32 = unsafe { ::std::mem::transmute(l2_type) }; l2_type as u64 @@ -419,15 +448,18 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { tun_type as u64 }); __bindgen_bitfield_unit.set(16usize, 4u8, { - let inner_l2_type: u32 = unsafe { ::std::mem::transmute(inner_l2_type) }; + let inner_l2_type: u32 = + unsafe { ::std::mem::transmute(inner_l2_type) }; inner_l2_type as u64 }); __bindgen_bitfield_unit.set(20usize, 4u8, { - let inner_l3_type: u32 = unsafe { ::std::mem::transmute(inner_l3_type) }; + let inner_l3_type: u32 = + unsafe { ::std::mem::transmute(inner_l3_type) }; inner_l3_type as u64 }); __bindgen_bitfield_unit.set(24usize, 4u8, { - let inner_l4_type: u32 = unsafe { ::std::mem::transmute(inner_l4_type) }; + let inner_l4_type: u32 = + unsafe { ::std::mem::transmute(inner_l4_type) }; inner_l4_type as u64 }); __bindgen_bitfield_unit @@ -447,7 +479,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).packet_type as *const _ as usize + &(*(::std::ptr::null::())).packet_type + as *const _ as usize }, 0usize, concat!( @@ -485,8 +518,9 @@ pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 { - pub __bindgen_anon_1: - __BindgenUnionField, + pub __bindgen_anon_1: __BindgenUnionField< + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, + >, pub lo: __BindgenUnionField, pub bindgen_union_field: u32, } @@ -497,49 +531,16 @@ pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { pub id: u16, } #[test] -fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!( - "Size of: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!( - "Alignment of ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { - & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . hash as * const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(hash) - ) - ); - assert_eq!( - unsafe { - & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . id as * const _ as usize - }, - 2usize, - concat!( - "Offset of field: ", - stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(id) - ) - ); +fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1( +) { + assert_eq ! ( :: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) , 4usize , concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) ) ); + assert_eq ! ( :: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) , 2usize , concat ! ( "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) ) ); + assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . hash as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( hash ) ) ); + assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ( ) ) ) . id as * const _ as usize } , 2usize , concat ! ( "Offset of field: " , stringify ! ( rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( id ) ) ); } -impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { +impl Clone + for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 +{ fn clone(&self) -> Self { *self } @@ -547,7 +548,8 @@ impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 #[test] fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::( + ), 4usize, concat!( "Size of: ", @@ -555,7 +557,9 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::< + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, + >(), 4usize, concat!( "Alignment of ", @@ -564,8 +568,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).lo - as *const _ as usize + &(*(::std::ptr::null::< + rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, + >())) + .lo as *const _ as usize }, 0usize, concat!( @@ -601,7 +607,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).hi as *const _ as usize + &(*(::std::ptr::null::())).hi + as *const _ as usize }, 4usize, concat!( @@ -643,7 +650,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).lo as *const _ as usize + &(*(::std::ptr::null::())).lo + as *const _ as usize }, 0usize, concat!( @@ -655,7 +663,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).hi as *const _ as usize + &(*(::std::ptr::null::())).hi + as *const _ as usize }, 4usize, concat!( @@ -684,7 +693,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rss as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rss as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -694,7 +706,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).fdir as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).fdir as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -704,7 +719,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).sched as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).sched as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -714,7 +732,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).usr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).usr as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -751,7 +772,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).userdata as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).userdata + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -761,7 +785,10 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).udata64 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).udata64 + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -781,7 +808,8 @@ impl Clone for rte_mbuf__bindgen_ty_4 { pub struct rte_mbuf__bindgen_ty_5 { ///< combined for easy fetch pub tx_offload: __BindgenUnionField, - pub __bindgen_anon_1: __BindgenUnionField, + pub __bindgen_anon_1: + __BindgenUnionField, pub bindgen_union_field: u64, } #[repr(C)] @@ -817,7 +845,9 @@ impl Clone for rte_mbuf__bindgen_ty_5__bindgen_ty_1 { impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { #[inline] pub fn l2_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u64) + } } #[inline] pub fn set_l2_len(&mut self, val: u64) { @@ -828,7 +858,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn l3_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u64) + } } #[inline] pub fn set_l3_len(&mut self, val: u64) { @@ -839,7 +871,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn l4_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u64) + } } #[inline] pub fn set_l4_len(&mut self, val: u64) { @@ -850,7 +884,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn tso_segsz(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 16u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(24usize, 16u8) as u64) + } } #[inline] pub fn set_tso_segsz(&mut self, val: u64) { @@ -861,7 +897,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn outer_l3_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 9u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(40usize, 9u8) as u64) + } } #[inline] pub fn set_outer_l3_len(&mut self, val: u64) { @@ -872,7 +910,9 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { } #[inline] pub fn outer_l2_len(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(49usize, 7u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(49usize, 7u8) as u64) + } } #[inline] pub fn set_outer_l2_len(&mut self, val: u64) { @@ -890,8 +930,10 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { outer_l3_len: u64, outer_l2_len: u64, ) -> __BindgenBitfieldUnit<[u8; 8usize], u16> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u16> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u16, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 7u8, { let l2_len: u64 = unsafe { ::std::mem::transmute(l2_len) }; l2_len as u64 @@ -909,11 +951,13 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { tso_segsz as u64 }); __bindgen_bitfield_unit.set(40usize, 9u8, { - let outer_l3_len: u64 = unsafe { ::std::mem::transmute(outer_l3_len) }; + let outer_l3_len: u64 = + unsafe { ::std::mem::transmute(outer_l3_len) }; outer_l3_len as u64 }); __bindgen_bitfield_unit.set(49usize, 7u8, { - let outer_l2_len: u64 = unsafe { ::std::mem::transmute(outer_l2_len) }; + let outer_l2_len: u64 = + unsafe { ::std::mem::transmute(outer_l2_len) }; outer_l2_len as u64 }); __bindgen_bitfield_unit @@ -933,7 +977,8 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).tx_offload as *const _ as usize + &(*(::std::ptr::null::())).tx_offload + as *const _ as usize }, 0usize, concat!( @@ -957,7 +1002,9 @@ fn bindgen_test_layout_rte_mbuf() { concat!("Size of: ", stringify!(rte_mbuf)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cacheline0 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cacheline0 as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -967,7 +1014,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_addr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_addr as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -977,7 +1026,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_physaddr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_physaddr as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", @@ -987,7 +1039,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).buf_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).buf_len as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -997,7 +1051,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rearm_data as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rearm_data as *const _ as usize + }, 18usize, concat!( "Offset of field: ", @@ -1007,7 +1063,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_off as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_off as *const _ as usize + }, 18usize, concat!( "Offset of field: ", @@ -1017,7 +1075,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).nb_segs as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).nb_segs as *const _ as usize + }, 22usize, concat!( "Offset of field: ", @@ -1027,7 +1087,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).port as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).port as *const _ as usize + }, 23usize, concat!( "Offset of field: ", @@ -1037,7 +1099,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).ol_flags as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).ol_flags as *const _ as usize + }, 24usize, concat!( "Offset of field: ", @@ -1047,7 +1111,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).rx_descriptor_fields1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).rx_descriptor_fields1 + as *const _ as usize + }, 32usize, concat!( "Offset of field: ", @@ -1057,7 +1124,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pkt_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pkt_len as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -1067,7 +1136,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).data_len as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).data_len as *const _ as usize + }, 40usize, concat!( "Offset of field: ", @@ -1077,7 +1148,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vlan_tci as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).vlan_tci as *const _ as usize + }, 42usize, concat!( "Offset of field: ", @@ -1087,7 +1160,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).hash as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).hash as *const _ as usize + }, 44usize, concat!( "Offset of field: ", @@ -1097,7 +1172,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).seqn as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).seqn as *const _ as usize + }, 52usize, concat!( "Offset of field: ", @@ -1107,7 +1184,10 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vlan_tci_outer as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).vlan_tci_outer as *const _ + as usize + }, 56usize, concat!( "Offset of field: ", @@ -1117,7 +1197,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).cacheline1 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).cacheline1 as *const _ as usize + }, 64usize, concat!( "Offset of field: ", @@ -1127,7 +1209,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).pool as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).pool as *const _ as usize + }, 72usize, concat!( "Offset of field: ", @@ -1137,7 +1221,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).next as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).next as *const _ as usize + }, 80usize, concat!( "Offset of field: ", @@ -1147,7 +1233,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).priv_size as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).priv_size as *const _ as usize + }, 96usize, concat!( "Offset of field: ", @@ -1157,7 +1245,9 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).timesync as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).timesync as *const _ as usize + }, 98usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang_version_specific_generated_tests.rs b/tests/expectations/tests/libclang_version_specific_generated_tests.rs index 93cf0d47cc..2643709c04 100644 --- a/tests/expectations/tests/libclang_version_specific_generated_tests.rs +++ b/tests/expectations/tests/libclang_version_specific_generated_tests.rs @@ -1 +1,4 @@ -include!(concat!(env!("OUT_DIR"), "/libclang_version_specific_generated_tests.rs")); +include!(concat!( + env!("OUT_DIR"), + "/libclang_version_specific_generated_tests.rs" +)); diff --git a/tests/expectations/tests/macro-expr-basic.rs b/tests/expectations/tests/macro-expr-basic.rs index 55590ff677..3f7b809935 100644 --- a/tests/expectations/tests/macro-expr-basic.rs +++ b/tests/expectations/tests/macro-expr-basic.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const FOO: u32 = 1; pub const BAR: u32 = 4; diff --git a/tests/expectations/tests/macro-expr-uncommon-token.rs b/tests/expectations/tests/macro-expr-uncommon-token.rs index 95093ad635..8c16a0d852 100644 --- a/tests/expectations/tests/macro-expr-uncommon-token.rs +++ b/tests/expectations/tests/macro-expr-uncommon-token.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const MODBUS_WOOT: u32 = 3; extern "C" { diff --git a/tests/expectations/tests/macro-redef.rs b/tests/expectations/tests/macro-redef.rs index e71322323e..3133bc0e0c 100644 --- a/tests/expectations/tests/macro-redef.rs +++ b/tests/expectations/tests/macro-redef.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const FOO: u32 = 4; pub const BAR: u32 = 5; diff --git a/tests/expectations/tests/maddness-is-avoidable.rs b/tests/expectations/tests/maddness-is-avoidable.rs index b1eea1d093..0e0ae290f1 100644 --- a/tests/expectations/tests/maddness-is-avoidable.rs +++ b/tests/expectations/tests/maddness-is-avoidable.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/mangling-ios.rs b/tests/expectations/tests/mangling-ios.rs index 87df5e4ad7..90dc8d46f2 100644 --- a/tests/expectations/tests/mangling-ios.rs +++ b/tests/expectations/tests/mangling-ios.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/mangling-linux32.rs b/tests/expectations/tests/mangling-linux32.rs index 7fe8f33a7f..faa9a2f8d5 100644 --- a/tests/expectations/tests/mangling-linux32.rs +++ b/tests/expectations/tests/mangling-linux32.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/mangling-linux64.rs b/tests/expectations/tests/mangling-linux64.rs index 7fe8f33a7f..faa9a2f8d5 100644 --- a/tests/expectations/tests/mangling-linux64.rs +++ b/tests/expectations/tests/mangling-linux64.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/mangling-macos.rs b/tests/expectations/tests/mangling-macos.rs index 7101b321d6..cc1ba069da 100644 --- a/tests/expectations/tests/mangling-macos.rs +++ b/tests/expectations/tests/mangling-macos.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/mangling-win64.rs b/tests/expectations/tests/mangling-win64.rs index 0d9c49faf7..d8c55e1c4f 100644 --- a/tests/expectations/tests/mangling-win64.rs +++ b/tests/expectations/tests/mangling-win64.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/method-mangling.rs b/tests/expectations/tests/method-mangling.rs index f2eb6f9802..7f72225adc 100644 --- a/tests/expectations/tests/method-mangling.rs +++ b/tests/expectations/tests/method-mangling.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/module-whitelisted.rs b/tests/expectations/tests/module-whitelisted.rs index 3f2d304e82..3771472d21 100644 --- a/tests/expectations/tests/module-whitelisted.rs +++ b/tests/expectations/tests/module-whitelisted.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs index 94d5a671a2..e7cab0a0b7 100644 --- a/tests/expectations/tests/msvc-no-usr.rs +++ b/tests/expectations/tests/msvc-no-usr.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs index 86147bdd10..d9c12e7b8f 100644 --- a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs +++ b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs index d60e6cf790..bfd939d3b9 100644 --- a/tests/expectations/tests/mutable.rs +++ b/tests/expectations/tests/mutable.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -61,7 +64,10 @@ fn bindgen_test_layout_NonCopiable() { concat!("Alignment of ", stringify!(NonCopiable)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).m_member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).m_member as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -96,8 +102,8 @@ fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).m_member as *const _ - as usize + &(*(::std::ptr::null::())) + .m_member as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs index dc51640e9e..7bb148f731 100644 --- a/tests/expectations/tests/namespace.rs +++ b/tests/expectations/tests/namespace.rs @@ -47,7 +47,12 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, 0usize, - concat!("Offset of field: ", stringify!(A), "::", stringify!(b)) + concat!( + "Offset of field: ", + stringify!(A), + "::", + stringify!(b) + ) ); } } @@ -73,7 +78,8 @@ pub mod root { #[derive(Debug)] pub struct D { pub m_c: root::C, - pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: + ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for D { fn default() -> Self { diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs index 4022909ccd..fdca4524a2 100644 --- a/tests/expectations/tests/nested.rs +++ b/tests/expectations/tests/nested.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -69,7 +72,9 @@ fn bindgen_test_layout_Test_Size() { concat!("Alignment of ", stringify!(Test_Size)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mWidth as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mWidth as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -79,7 +84,9 @@ fn bindgen_test_layout_Test_Size() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mHeight as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mHeight as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs index 4082610644..e11496e2db 100644 --- a/tests/expectations/tests/nested_vtable.rs +++ b/tests/expectations/tests/nested_vtable.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct nsISupports__bindgen_vtable(::std::os::raw::c_void); @@ -31,7 +34,9 @@ impl Default for nsISupports { } extern "C" { #[link_name = "\u{1}_ZN11nsISupports14QueryInterfaceEv"] - pub fn nsISupports_QueryInterface(this: *mut ::std::os::raw::c_void) -> *mut nsISupports; + pub fn nsISupports_QueryInterface( + this: *mut ::std::os::raw::c_void, + ) -> *mut nsISupports; } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs index 868510e8a1..e329930532 100644 --- a/tests/expectations/tests/nested_within_namespace.rs +++ b/tests/expectations/tests/nested_within_namespace.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -34,7 +37,9 @@ pub mod root { concat!("Alignment of ", stringify!(Bar_Baz)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -57,9 +62,16 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(foo) + ) ); } #[repr(C)] @@ -80,9 +92,16 @@ pub mod root { concat!("Alignment of ", stringify!(Baz)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).baz as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Baz), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(Baz), + "::", + stringify!(baz) + ) ); } } diff --git a/tests/expectations/tests/no-comments.rs b/tests/expectations/tests/no-comments.rs index 65f6962437..f78bae9921 100644 --- a/tests/expectations/tests/no-comments.rs +++ b/tests/expectations/tests/no-comments.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/no-hash-whitelisted.rs b/tests/expectations/tests/no-hash-whitelisted.rs index fd54300d29..bcb38b5c51 100644 --- a/tests/expectations/tests/no-hash-whitelisted.rs +++ b/tests/expectations/tests/no-hash-whitelisted.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/no-partialeq-whitelisted.rs b/tests/expectations/tests/no-partialeq-whitelisted.rs index 00f7210e8e..17fec747fb 100644 --- a/tests/expectations/tests/no-partialeq-whitelisted.rs +++ b/tests/expectations/tests/no-partialeq-whitelisted.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -22,7 +25,9 @@ fn bindgen_test_layout_NoPartialEq() { concat!("Alignment of ", stringify!(NoPartialEq)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs index 524b307a57..e884cfb07b 100644 --- a/tests/expectations/tests/no-std.rs +++ b/tests/expectations/tests/no-std.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![no_std] mod libc { pub type c_int = i32; diff --git a/tests/expectations/tests/no_copy_whitelisted.rs b/tests/expectations/tests/no_copy_whitelisted.rs index 340fc1ece6..74fda3b2b3 100644 --- a/tests/expectations/tests/no_copy_whitelisted.rs +++ b/tests/expectations/tests/no_copy_whitelisted.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] diff --git a/tests/expectations/tests/non-type-params.rs b/tests/expectations/tests/non-type-params.rs index 4ba6425748..50b3a273fa 100644 --- a/tests/expectations/tests/non-type-params.rs +++ b/tests/expectations/tests/non-type-params.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type Array16 = u8; pub type ArrayInt4 = [u32; 4usize]; @@ -26,7 +29,10 @@ fn bindgen_test_layout_UsesArray() { concat!("Alignment of ", stringify!(UsesArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).array_char_16 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).array_char_16 as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -36,7 +42,10 @@ fn bindgen_test_layout_UsesArray() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).array_bool_8 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).array_bool_8 as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -46,7 +55,10 @@ fn bindgen_test_layout_UsesArray() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).array_int_4 as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).array_int_4 as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/nsBaseHashtable.rs b/tests/expectations/tests/nsBaseHashtable.rs index 338978e1c8..8006c92e17 100644 --- a/tests/expectations/tests/nsBaseHashtable.rs +++ b/tests/expectations/tests/nsBaseHashtable.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs index bd5e7f4b83..fc1b4f3287 100644 --- a/tests/expectations/tests/nsStyleAutoArray.rs +++ b/tests/expectations/tests/nsStyleAutoArray.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/objc_category.rs b/tests/expectations/tests/objc_category.rs index ba37b819cf..48970fdee5 100644 --- a/tests/expectations/tests/objc_category.rs +++ b/tests/expectations/tests/objc_category.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_class.rs b/tests/expectations/tests/objc_class.rs index 062cab3f20..e312f7a5ac 100644 --- a/tests/expectations/tests/objc_class.rs +++ b/tests/expectations/tests/objc_class.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_class_method.rs b/tests/expectations/tests/objc_class_method.rs index a365024e81..42245b9984 100644 --- a/tests/expectations/tests/objc_class_method.rs +++ b/tests/expectations/tests/objc_class_method.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_interface.rs b/tests/expectations/tests/objc_interface.rs index e8c1278ac2..b49f21f7d7 100644 --- a/tests/expectations/tests/objc_interface.rs +++ b/tests/expectations/tests/objc_interface.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs index 0b77b5bec0..5868aa7fb3 100644 --- a/tests/expectations/tests/objc_interface_type.rs +++ b/tests/expectations/tests/objc_interface_type.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] @@ -28,7 +32,9 @@ fn bindgen_test_layout_FooStruct() { concat!("Alignment of ", stringify!(FooStruct)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/objc_method.rs b/tests/expectations/tests/objc_method.rs index bd6e748a91..2c61aa2381 100644 --- a/tests/expectations/tests/objc_method.rs +++ b/tests/expectations/tests/objc_method.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_method_clash.rs b/tests/expectations/tests/objc_method_clash.rs index 10e7d54443..739d2aa96f 100644 --- a/tests/expectations/tests/objc_method_clash.rs +++ b/tests/expectations/tests/objc_method_clash.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_property_fnptr.rs b/tests/expectations/tests/objc_property_fnptr.rs index 94ebfad640..a1c4b3d2c3 100644 --- a/tests/expectations/tests/objc_property_fnptr.rs +++ b/tests/expectations/tests/objc_property_fnptr.rs @@ -24,7 +24,9 @@ pub trait Foo { >; unsafe fn setFunc_( self, - func: ::std::option::Option ::std::os::raw::c_int>, + func: ::std::option::Option< + unsafe extern "C" fn() -> ::std::os::raw::c_int, + >, ); } impl Foo for id { @@ -41,7 +43,9 @@ impl Foo for id { } unsafe fn setFunc_( self, - func: ::std::option::Option ::std::os::raw::c_int>, + func: ::std::option::Option< + unsafe extern "C" fn() -> ::std::os::raw::c_int, + >, ) { msg_send!(self, setFunc: func) } diff --git a/tests/expectations/tests/objc_protocol.rs b/tests/expectations/tests/objc_protocol.rs index 33a81fa44c..aeb6de026b 100644 --- a/tests/expectations/tests/objc_protocol.rs +++ b/tests/expectations/tests/objc_protocol.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_sel_and_id.rs b/tests/expectations/tests/objc_sel_and_id.rs index da69c7a897..b48575633d 100644 --- a/tests/expectations/tests/objc_sel_and_id.rs +++ b/tests/expectations/tests/objc_sel_and_id.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] diff --git a/tests/expectations/tests/objc_whitelist.rs b/tests/expectations/tests/objc_whitelist.rs index eba2b2983a..3089fb7f69 100644 --- a/tests/expectations/tests/objc_whitelist.rs +++ b/tests/expectations/tests/objc_whitelist.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(target_os = "macos")] #[macro_use] @@ -17,7 +22,8 @@ impl protocol_SomeProtocol for id { } unsafe fn protocolClassMethod() { msg_send!( - objc::runtime::Class::get("SomeProtocol").expect("Couldn't find SomeProtocol"), + objc::runtime::Class::get("SomeProtocol") + .expect("Couldn't find SomeProtocol"), protocolClassMethod ) } @@ -32,7 +38,8 @@ impl WhitelistMe for id { } unsafe fn classMethod() { msg_send!( - objc::runtime::Class::get("WhitelistMe").expect("Couldn't find WhitelistMe"), + objc::runtime::Class::get("WhitelistMe") + .expect("Couldn't find WhitelistMe"), classMethod ) } diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs index b5db31affd..24721b6082 100644 --- a/tests/expectations/tests/only_bitfields.rs +++ b/tests/expectations/tests/only_bitfields.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -109,7 +115,9 @@ fn bindgen_test_layout_C() { impl C { #[inline] pub fn a(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) + } } #[inline] pub fn set_a(&mut self, val: bool) { @@ -120,7 +128,9 @@ impl C { } #[inline] pub fn b(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) + } } #[inline] pub fn set_b(&mut self, val: bool) { @@ -130,9 +140,14 @@ impl C { } } #[inline] - pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + a: bool, + b: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u8 = unsafe { ::std::mem::transmute(a) }; a as u64 diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs index b5afc66714..2054397c9b 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -34,7 +34,10 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { concat!("Alignment of ", stringify!(ContainsOpaqueTemplate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBlah as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBlah as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -44,7 +47,10 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBaz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBaz as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -74,7 +80,10 @@ fn bindgen_test_layout_InheritsOpaqueTemplate() { concat!("Alignment of ", stringify!(InheritsOpaqueTemplate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).wow as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).wow as *const _ + as usize + }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs index 87e98dafea..66a2f049ee 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -32,7 +32,10 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { concat!("Alignment of ", stringify!(ContainsOpaqueTemplate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBlah as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBlah as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +45,10 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBaz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBaz as *const _ + as usize + }, 404usize, concat!( "Offset of field: ", @@ -82,7 +88,10 @@ fn bindgen_test_layout_InheritsOpaqueTemplate() { concat!("Alignment of ", stringify!(InheritsOpaqueTemplate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).wow as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).wow as *const _ + as usize + }, 408usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs index 4f5b0cb970..ff9d89444d 100644 --- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs +++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -15,7 +18,8 @@ pub mod root { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Template { pub member: T, - pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: + ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Template { fn default() -> Self { @@ -40,9 +44,16 @@ pub mod root { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Foo), "::", stringify!(c)) + concat!( + "Offset of field: ", + stringify!(Foo), + "::", + stringify!(c) + ) ); } #[repr(C)] @@ -63,9 +74,16 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).i as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(i)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(i) + ) ); } #[repr(C)] @@ -87,8 +105,8 @@ pub mod root { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).not_opaque as *const _ - as usize + &(*(::std::ptr::null::())).not_opaque + as *const _ as usize }, 0usize, concat!( @@ -119,12 +137,15 @@ pub mod root { assert_eq!( ::std::mem::align_of::(), 4usize, - concat!("Alignment of ", stringify!(ContainsOpaqueInstantiation)) + concat!( + "Alignment of ", + stringify!(ContainsOpaqueInstantiation) + ) ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).opaque as *const _ - as usize + &(*(::std::ptr::null::())) + .opaque as *const _ as usize }, 0usize, concat!( @@ -139,7 +160,8 @@ pub mod root { #[test] fn __bindgen_test_layout_Template_open0_Foo_close0_instantiation() { assert_eq!( - ::std::mem::size_of::>(), + ::std::mem::size_of::>( + ), 1usize, concat!( "Size of template specialization: ", @@ -147,7 +169,8 @@ pub mod root { ) ); assert_eq!( - ::std::mem::align_of::>(), + ::std::mem::align_of::>( + ), 1usize, concat!( "Alignment of template specialization: ", diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs index c3043abf19..67828313e2 100644 --- a/tests/expectations/tests/opaque-template-instantiation.rs +++ b/tests/expectations/tests/opaque-template-instantiation.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -34,7 +37,8 @@ fn bindgen_test_layout_ContainsInstantiation() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).not_opaque as *const _ as usize + &(*(::std::ptr::null::())).not_opaque + as *const _ as usize }, 0usize, concat!( @@ -69,7 +73,8 @@ fn bindgen_test_layout_ContainsOpaqueInstantiation() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).opaque as *const _ as usize + &(*(::std::ptr::null::())).opaque + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs index 9301f7ab86..0209e5b05f 100644 --- a/tests/expectations/tests/opaque_in_struct.rs +++ b/tests/expectations/tests/opaque_in_struct.rs @@ -45,7 +45,9 @@ fn bindgen_test_layout_container() { concat!("Alignment of ", stringify!(container)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).contained as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).contained as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs index 3ec962144f..1d79906d39 100644 --- a/tests/expectations/tests/opaque_pointer.rs +++ b/tests/expectations/tests/opaque_pointer.rs @@ -53,7 +53,10 @@ fn bindgen_test_layout_WithOpaquePtr() { concat!("Alignment of ", stringify!(WithOpaquePtr)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).whatever as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).whatever as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -63,7 +66,9 @@ fn bindgen_test_layout_WithOpaquePtr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).other as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).other as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -73,7 +78,9 @@ fn bindgen_test_layout_WithOpaquePtr() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).t as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).t as *const _ as usize + }, 12usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/overflowed_enum.rs b/tests/expectations/tests/overflowed_enum.rs index 25e9178601..31b88621af 100644 --- a/tests/expectations/tests/overflowed_enum.rs +++ b/tests/expectations/tests/overflowed_enum.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/overloading.rs b/tests/expectations/tests/overloading.rs index 28b783c334..ae16f14c0f 100644 --- a/tests/expectations/tests/overloading.rs +++ b/tests/expectations/tests/overloading.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { #[link_name = "\u{1}_Z8Evaluatec"] @@ -10,7 +13,10 @@ extern "C" { } extern "C" { #[link_name = "\u{1}_Z8Evaluateii"] - pub fn Evaluate1(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) -> bool; + pub fn Evaluate1( + x: ::std::os::raw::c_int, + y: ::std::os::raw::c_int, + ) -> bool; } extern "C" { #[link_name = "\u{1}_ZN3foo10MyFunctionEv"] diff --git a/tests/expectations/tests/prepend_enum_name.rs b/tests/expectations/tests/prepend_enum_name.rs index 96c7b617ae..1c88438b9b 100644 --- a/tests/expectations/tests/prepend_enum_name.rs +++ b/tests/expectations/tests/prepend_enum_name.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const FOO_BAR: foo = 0; pub const FOO_BAZ: foo = 1; diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs index 5088d9c9db..618e68c052 100644 --- a/tests/expectations/tests/private.rs +++ b/tests/expectations/tests/private.rs @@ -27,7 +27,10 @@ fn bindgen_test_layout_HasPrivate() { concat!("Alignment of ", stringify!(HasPrivate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mNotPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mNotPrivate as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -37,7 +40,10 @@ fn bindgen_test_layout_HasPrivate() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mIsPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mIsPrivate as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -67,7 +73,10 @@ fn bindgen_test_layout_VeryPrivate() { concat!("Alignment of ", stringify!(VeryPrivate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mIsPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mIsPrivate as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -77,7 +86,10 @@ fn bindgen_test_layout_VeryPrivate() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mIsAlsoPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mIsAlsoPrivate as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", @@ -108,7 +120,10 @@ fn bindgen_test_layout_ContradictPrivate() { concat!("Alignment of ", stringify!(ContradictPrivate)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mNotPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mNotPrivate + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -118,7 +133,10 @@ fn bindgen_test_layout_ContradictPrivate() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mIsPrivate as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mIsPrivate as *const _ + as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/public-dtor.rs b/tests/expectations/tests/public-dtor.rs index f551c2cbf5..55b289df6f 100644 --- a/tests/expectations/tests/public-dtor.rs +++ b/tests/expectations/tests/public-dtor.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] diff --git a/tests/expectations/tests/redeclaration.rs b/tests/expectations/tests/redeclaration.rs index 87df5e4ad7..90dc8d46f2 100644 --- a/tests/expectations/tests/redeclaration.rs +++ b/tests/expectations/tests/redeclaration.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { pub fn foo(); diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs index 89ae83c993..d31c774332 100644 --- a/tests/expectations/tests/ref_argument_array.rs +++ b/tests/expectations/tests/ref_argument_array.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const NSID_LENGTH: u32 = 10; #[repr(C)] diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs index 8fc38cd7da..bfc65febfa 100644 --- a/tests/expectations/tests/reparented_replacement.rs +++ b/tests/expectations/tests/reparented_replacement.rs @@ -33,9 +33,16 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).bazz as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).bazz as *const _ as usize + }, 0usize, - concat!("Offset of field: ", stringify!(Bar), "::", stringify!(bazz)) + concat!( + "Offset of field: ", + stringify!(Bar), + "::", + stringify!(bazz) + ) ); } } diff --git a/tests/expectations/tests/resolved_type_def_function.rs b/tests/expectations/tests/resolved_type_def_function.rs index f400c9fed1..bf7489207e 100644 --- a/tests/expectations/tests/resolved_type_def_function.rs +++ b/tests/expectations/tests/resolved_type_def_function.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type FuncType = ::std::option::Option; extern "C" { diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs index 9a8c1efa14..166abffbe9 100644 --- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs +++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -26,7 +31,9 @@ fn bindgen_test_layout_JS_shadow_Zone() { concat!("Alignment of ", stringify!(JS_shadow_Zone)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -36,7 +43,9 @@ fn bindgen_test_layout_JS_shadow_Zone() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs index 7f96b45023..47773a48d3 100644 --- a/tests/expectations/tests/sentry-defined-multiple-times.rs +++ b/tests/expectations/tests/sentry-defined-multiple-times.rs @@ -43,7 +43,8 @@ pub mod root { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).i_am_plain_sentry as *const _ as usize + &(*(::std::ptr::null::())).i_am_plain_sentry + as *const _ as usize }, 0usize, concat!( @@ -92,7 +93,8 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())) - .i_am_not_template_wrapper_sentry as *const _ as usize + .i_am_not_template_wrapper_sentry + as *const _ as usize }, 0usize, concat!( @@ -118,18 +120,24 @@ pub mod root { assert_eq!( ::std::mem::size_of::(), 1usize, - concat!("Size of: ", stringify!(InlineNotTemplateWrapper_sentry)) + concat!( + "Size of: ", + stringify!(InlineNotTemplateWrapper_sentry) + ) ); assert_eq!( ::std::mem::align_of::(), 1usize, - concat!("Alignment of ", stringify!(InlineNotTemplateWrapper_sentry)) + concat!( + "Alignment of ", + stringify!(InlineNotTemplateWrapper_sentry) + ) ); assert_eq!( unsafe { &(*(::std::ptr::null::())) - .i_am_inline_not_template_wrapper_sentry as *const _ - as usize + .i_am_inline_not_template_wrapper_sentry + as *const _ as usize }, 0usize, concat!( @@ -213,7 +221,9 @@ pub mod root { #[test] fn bindgen_test_layout_OuterDoubleWrapper_InnerDoubleWrapper_sentry() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::< + OuterDoubleWrapper_InnerDoubleWrapper_sentry, + >(), 4usize, concat!( "Size of: ", @@ -221,7 +231,9 @@ pub mod root { ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::< + OuterDoubleWrapper_InnerDoubleWrapper_sentry, + >(), 4usize, concat!( "Alignment of ", @@ -230,8 +242,11 @@ pub mod root { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())) - .i_am_double_wrapper_sentry as *const _ as usize + &(*(::std::ptr::null::< + OuterDoubleWrapper_InnerDoubleWrapper_sentry, + >())) + .i_am_double_wrapper_sentry as *const _ + as usize }, 0usize, concat!( @@ -258,52 +273,37 @@ pub mod root { pub i_am_double_wrapper_inline_sentry: ::std::os::raw::c_int, } #[test] - fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry() { - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!( - "Size of: ", - stringify!(OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!( - "Alignment of ", - stringify!(OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) - ) - ); - assert_eq!( - unsafe { - & ( * ( :: std :: ptr :: null :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ( ) ) ) . i_am_double_wrapper_inline_sentry as * const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry), - "::", - stringify!(i_am_double_wrapper_inline_sentry) - ) - ); + fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry( + ) { + assert_eq ! ( :: std :: mem :: size_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ( ) , 4usize , concat ! ( "Size of: " , stringify ! ( OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry ) ) ); + assert_eq ! ( :: std :: mem :: align_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry ) ) ); + assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ( ) ) ) . i_am_double_wrapper_inline_sentry as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry ) , "::" , stringify ! ( i_am_double_wrapper_inline_sentry ) ) ); } #[test] - fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper() { + fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper( + ) { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::< + OuterDoubleInlineWrapper_InnerDoubleInlineWrapper, + >(), 1usize, concat!( "Size of: ", - stringify!(OuterDoubleInlineWrapper_InnerDoubleInlineWrapper) + stringify!( + OuterDoubleInlineWrapper_InnerDoubleInlineWrapper + ) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::< + OuterDoubleInlineWrapper_InnerDoubleInlineWrapper, + >(), 1usize, concat!( "Alignment of ", - stringify!(OuterDoubleInlineWrapper_InnerDoubleInlineWrapper) + stringify!( + OuterDoubleInlineWrapper_InnerDoubleInlineWrapper + ) ) ); } @@ -350,8 +350,8 @@ pub mod root { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).i_am_outside_namespace_sentry as *const _ - as usize + &(*(::std::ptr::null::())).i_am_outside_namespace_sentry + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/short-enums.rs b/tests/expectations/tests/short-enums.rs index a7739f21ec..835a7ac83a 100644 --- a/tests/expectations/tests/short-enums.rs +++ b/tests/expectations/tests/short-enums.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(u8)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs index 8bc5430088..fde0174a83 100644 --- a/tests/expectations/tests/size_t_template.rs +++ b/tests/expectations/tests/size_t_template.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs index de2efda507..bf79ee0e5f 100644 --- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs +++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs index f85aeb4c09..47505e5017 100644 --- a/tests/expectations/tests/struct_typedef.rs +++ b/tests/expectations/tests/struct_typedef.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -20,7 +25,10 @@ fn bindgen_test_layout_typedef_named_struct() { concat!("Alignment of ", stringify!(typedef_named_struct)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).has_name as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).has_name + as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -48,7 +56,10 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_bindgen_ty_1>())).no_name as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::<_bindgen_ty_1>())).no_name as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs index 79fa38de43..1a9757778a 100644 --- a/tests/expectations/tests/struct_typedef_ns.rs +++ b/tests/expectations/tests/struct_typedef_ns.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -27,7 +32,10 @@ pub mod root { concat!("Alignment of ", stringify!(typedef_struct)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).foo as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -64,7 +72,10 @@ pub mod root { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::<_bindgen_ty_1>())).foo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::<_bindgen_ty_1>())).foo as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -75,8 +86,8 @@ pub mod root { ); } pub type typedef_struct = root::_bindgen_mod_id_12::_bindgen_ty_1; - pub const _bindgen_mod_id_12_BAR: root::_bindgen_mod_id_12::_bindgen_ty_2 = - _bindgen_ty_2::BAR; + pub const _bindgen_mod_id_12_BAR: + root::_bindgen_mod_id_12::_bindgen_ty_2 = _bindgen_ty_2::BAR; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum _bindgen_ty_2 { diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs index 5dcdaf8c46..5a63100827 100644 --- a/tests/expectations/tests/struct_with_anon_struct.rs +++ b/tests/expectations/tests/struct_with_anon_struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -28,7 +31,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +43,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs index 7af227a11b..7261647116 100644 --- a/tests/expectations/tests/struct_with_anon_struct_array.rs +++ b/tests/expectations/tests/struct_with_anon_struct_array.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -29,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -39,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -68,7 +75,9 @@ fn bindgen_test_layout_foo__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -78,7 +87,9 @@ fn bindgen_test_layout_foo__bindgen_ty_2() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs index 906ff46946..e5bd27fd36 100644 --- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs +++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -28,7 +31,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +43,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs index d0328d340e..b630c54c30 100644 --- a/tests/expectations/tests/struct_with_anon_union.rs +++ b/tests/expectations/tests/struct_with_anon_union.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_union_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs index 88e27efee9..ed6450afc1 100644 --- a/tests/expectations/tests/struct_with_anon_union_1_0.rs +++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -72,7 +75,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -82,7 +87,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs index b2baff9347..a304dbb9f6 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -28,7 +31,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +43,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs index abb0bd3f85..6e34fa2977 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs index 43ff66bc4f..b2b6923d80 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -72,7 +75,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -82,7 +87,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs index 3f99eb0268..0a8564696c 100644 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ b/tests/expectations/tests/struct_with_bitfields.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -121,7 +127,9 @@ fn bindgen_test_layout_bitfield() { impl bitfield { #[inline] pub fn a(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) + } } #[inline] pub fn set_a(&mut self, val: ::std::os::raw::c_ushort) { @@ -132,7 +140,9 @@ impl bitfield { } #[inline] pub fn b(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) + } } #[inline] pub fn set_b(&mut self, val: ::std::os::raw::c_ushort) { @@ -143,7 +153,9 @@ impl bitfield { } #[inline] pub fn c(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) + } } #[inline] pub fn set_c(&mut self, val: ::std::os::raw::c_ushort) { @@ -154,7 +166,9 @@ impl bitfield { } #[inline] pub fn d(&self) -> ::std::os::raw::c_ushort { - unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 2u8) as u16) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(6usize, 2u8) as u16) + } } #[inline] pub fn set_d(&mut self, val: ::std::os::raw::c_ushort) { @@ -170,8 +184,10 @@ impl bitfield { c: ::std::os::raw::c_ushort, d: ::std::os::raw::c_ushort, ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let a: u16 = unsafe { ::std::mem::transmute(a) }; a as u64 @@ -192,7 +208,9 @@ impl bitfield { } #[inline] pub fn f(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 2u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(0usize, 2u8) as u32) + } } #[inline] pub fn set_f(&mut self, val: ::std::os::raw::c_uint) { @@ -203,7 +221,9 @@ impl bitfield { } #[inline] pub fn g(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_2.get(32usize, 32u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(32usize, 32u8) as u32) + } } #[inline] pub fn set_g(&mut self, val: ::std::os::raw::c_uint) { @@ -217,8 +237,10 @@ impl bitfield { f: ::std::os::raw::c_uint, g: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 8usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 2u8, { let f: u32 = unsafe { ::std::mem::transmute(f) }; f as u64 diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs index 205e565df7..73c7e4ffff 100644 --- a/tests/expectations/tests/struct_with_derive_debug.rs +++ b/tests/expectations/tests/struct_with_derive_debug.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -22,7 +25,9 @@ fn bindgen_test_layout_LittleArray() { concat!("Alignment of ", stringify!(LittleArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -83,7 +88,9 @@ fn bindgen_test_layout_WithLittleArray() { concat!("Alignment of ", stringify!(WithLittleArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -111,7 +118,9 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_large_array.rs b/tests/expectations/tests/struct_with_large_array.rs index 43388edae8..5321aa10a4 100644 --- a/tests/expectations/tests/struct_with_large_array.rs +++ b/tests/expectations/tests/struct_with_large_array.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Copy, Clone)] @@ -22,7 +25,9 @@ fn bindgen_test_layout_S() { concat!("Alignment of ", stringify!(S)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).large_array as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).large_array as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs index 73787d8611..872c1476d0 100644 --- a/tests/expectations/tests/struct_with_nesting.rs +++ b/tests/expectations/tests/struct_with_nesting.rs @@ -41,7 +41,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c1 as *const _ as usize + &(*(::std::ptr::null::())).c1 + as *const _ as usize }, 0usize, concat!( @@ -53,7 +54,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c2 as *const _ as usize + &(*(::std::ptr::null::())).c2 + as *const _ as usize }, 2usize, concat!( @@ -86,7 +88,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d1 as *const _ as usize + &(*(::std::ptr::null::())).d1 + as *const _ as usize }, 0usize, concat!( @@ -98,7 +101,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d2 as *const _ as usize + &(*(::std::ptr::null::())).d2 + as *const _ as usize }, 1usize, concat!( @@ -110,7 +114,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d3 as *const _ as usize + &(*(::std::ptr::null::())).d3 + as *const _ as usize }, 2usize, concat!( @@ -122,7 +127,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d4 as *const _ as usize + &(*(::std::ptr::null::())).d4 + as *const _ as usize }, 3usize, concat!( @@ -146,7 +152,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs index 569a7b8186..221215b23e 100644 --- a/tests/expectations/tests/struct_with_nesting_1_0.rs +++ b/tests/expectations/tests/struct_with_nesting_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -81,7 +84,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c1 as *const _ as usize + &(*(::std::ptr::null::())).c1 + as *const _ as usize }, 0usize, concat!( @@ -93,7 +97,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c2 as *const _ as usize + &(*(::std::ptr::null::())).c2 + as *const _ as usize }, 2usize, concat!( @@ -131,7 +136,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d1 as *const _ as usize + &(*(::std::ptr::null::())).d1 + as *const _ as usize }, 0usize, concat!( @@ -143,7 +149,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d2 as *const _ as usize + &(*(::std::ptr::null::())).d2 + as *const _ as usize }, 1usize, concat!( @@ -155,7 +162,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d3 as *const _ as usize + &(*(::std::ptr::null::())).d3 + as *const _ as usize }, 2usize, concat!( @@ -167,7 +175,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).d4 as *const _ as usize + &(*(::std::ptr::null::())).d4 + as *const _ as usize }, 3usize, concat!( @@ -196,7 +205,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs index 410d8f4a04..2012349831 100644 --- a/tests/expectations/tests/struct_with_packing.rs +++ b/tests/expectations/tests/struct_with_packing.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C, packed)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs index 95d66bf8f9..9ed9454f86 100644 --- a/tests/expectations/tests/struct_with_struct.rs +++ b/tests/expectations/tests/struct_with_struct.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -28,7 +31,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +43,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).y as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).y as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_typedef_template_arg.rs b/tests/expectations/tests/struct_with_typedef_template_arg.rs index 2c21656ad6..8b617ca475 100644 --- a/tests/expectations/tests/struct_with_typedef_template_arg.rs +++ b/tests/expectations/tests/struct_with_typedef_template_arg.rs @@ -1,12 +1,16 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Proxy { pub _address: u8, } -pub type Proxy_foo = ::std::option::Option; +pub type Proxy_foo = + ::std::option::Option; diff --git a/tests/expectations/tests/template-fun-ty.rs b/tests/expectations/tests/template-fun-ty.rs index cce6c24d3c..225099fa88 100644 --- a/tests/expectations/tests/template-fun-ty.rs +++ b/tests/expectations/tests/template-fun-ty.rs @@ -1,15 +1,19 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Foo { pub _address: u8, } -pub type Foo_FunctionPtr = ::std::option::Option T>; +pub type Foo_FunctionPtr = + ::std::option::Option T>; #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct RefPtr { @@ -20,7 +24,6 @@ pub struct RefPtr { pub struct RefPtr_Proxy { pub _address: u8, } -pub type RefPtr_Proxy_member_function = ::std::option::Option< - unsafe extern "C" fn(arg1: Args) -> R, ->; +pub type RefPtr_Proxy_member_function = + ::std::option::Option R>; pub type Returner = ::std::option::Option T>; diff --git a/tests/expectations/tests/template-param-usage-0.rs b/tests/expectations/tests/template-param-usage-0.rs index d5ca7d7dac..adc8219d81 100644 --- a/tests/expectations/tests/template-param-usage-0.rs +++ b/tests/expectations/tests/template-param-usage-0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-1.rs b/tests/expectations/tests/template-param-usage-1.rs index 95e41077b5..ec8ad32c30 100644 --- a/tests/expectations/tests/template-param-usage-1.rs +++ b/tests/expectations/tests/template-param-usage-1.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-10.rs b/tests/expectations/tests/template-param-usage-10.rs index 940be664bc..ced48333f2 100644 --- a/tests/expectations/tests/template-param-usage-10.rs +++ b/tests/expectations/tests/template-param-usage-10.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-11.rs b/tests/expectations/tests/template-param-usage-11.rs index 1b2335bb1e..d226373811 100644 --- a/tests/expectations/tests/template-param-usage-11.rs +++ b/tests/expectations/tests/template-param-usage-11.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-12.rs b/tests/expectations/tests/template-param-usage-12.rs index d6a540851b..c0391fafa8 100644 --- a/tests/expectations/tests/template-param-usage-12.rs +++ b/tests/expectations/tests/template-param-usage-12.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-13.rs b/tests/expectations/tests/template-param-usage-13.rs index 855c76fefd..50b40a8b0a 100644 --- a/tests/expectations/tests/template-param-usage-13.rs +++ b/tests/expectations/tests/template-param-usage-13.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-14.rs b/tests/expectations/tests/template-param-usage-14.rs index 97dbba46fd..d093fd7395 100644 --- a/tests/expectations/tests/template-param-usage-14.rs +++ b/tests/expectations/tests/template-param-usage-14.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-15.rs b/tests/expectations/tests/template-param-usage-15.rs index 405e8198e8..25792de08e 100644 --- a/tests/expectations/tests/template-param-usage-15.rs +++ b/tests/expectations/tests/template-param-usage-15.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-2.rs b/tests/expectations/tests/template-param-usage-2.rs index 24086724a0..1f40e41ec3 100644 --- a/tests/expectations/tests/template-param-usage-2.rs +++ b/tests/expectations/tests/template-param-usage-2.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-3.rs b/tests/expectations/tests/template-param-usage-3.rs index 0e5d2fdf0e..5564af8983 100644 --- a/tests/expectations/tests/template-param-usage-3.rs +++ b/tests/expectations/tests/template-param-usage-3.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -18,7 +21,9 @@ pub struct UsesTemplateParameter_AlsoUsesTemplateParameterAndMore { pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } -impl Default for UsesTemplateParameter_AlsoUsesTemplateParameterAndMore { +impl Default + for UsesTemplateParameter_AlsoUsesTemplateParameterAndMore +{ fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-4.rs b/tests/expectations/tests/template-param-usage-4.rs index af36754f00..35af5befa8 100644 --- a/tests/expectations/tests/template-param-usage-4.rs +++ b/tests/expectations/tests/template-param-usage-4.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-5.rs b/tests/expectations/tests/template-param-usage-5.rs index 46ae3513c6..218264fec9 100644 --- a/tests/expectations/tests/template-param-usage-5.rs +++ b/tests/expectations/tests/template-param-usage-5.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-6.rs b/tests/expectations/tests/template-param-usage-6.rs index f76e6326e6..d6f5a14a4c 100644 --- a/tests/expectations/tests/template-param-usage-6.rs +++ b/tests/expectations/tests/template-param-usage-6.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-7.rs b/tests/expectations/tests/template-param-usage-7.rs index b30c82b40e..71a5de1f0c 100644 --- a/tests/expectations/tests/template-param-usage-7.rs +++ b/tests/expectations/tests/template-param-usage-7.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-8.rs b/tests/expectations/tests/template-param-usage-8.rs index 75e14706f5..9ea1ae68bb 100644 --- a/tests/expectations/tests/template-param-usage-8.rs +++ b/tests/expectations/tests/template-param-usage-8.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-9.rs b/tests/expectations/tests/template-param-usage-9.rs index 3071924e49..2e109f19f1 100644 --- a/tests/expectations/tests/template-param-usage-9.rs +++ b/tests/expectations/tests/template-param-usage-9.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-with-var.rs b/tests/expectations/tests/template-with-var.rs index 0b0a8cb6b2..36d5404997 100644 --- a/tests/expectations/tests/template-with-var.rs +++ b/tests/expectations/tests/template-with-var.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index c015297288..294ee98048 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -77,7 +77,9 @@ fn bindgen_test_layout_C() { concat!("Offset of field: ", stringify!(C), "::", stringify!(mB)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstPtr as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -87,7 +89,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstStructPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstStructPtr as *const _ as usize + }, 16usize, concat!( "Offset of field: ", @@ -97,7 +101,10 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstStructPtrArray as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstStructPtrArray as *const _ + as usize + }, 24usize, concat!( "Offset of field: ", @@ -117,7 +124,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBVolatile as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBVolatile as *const _ as usize + }, 36usize, concat!( "Offset of field: ", @@ -127,7 +136,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstBool as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstBool as *const _ as usize + }, 40usize, concat!( "Offset of field: ", @@ -137,7 +148,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstChar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstChar as *const _ as usize + }, 42usize, concat!( "Offset of field: ", @@ -157,7 +170,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBPtrArray as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBPtrArray as *const _ as usize + }, 48usize, concat!( "Offset of field: ", @@ -167,7 +182,9 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBArrayPtr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBArrayPtr as *const _ as usize + }, 56usize, concat!( "Offset of field: ", @@ -182,7 +199,9 @@ fn bindgen_test_layout_C() { concat!("Offset of field: ", stringify!(C), "::", stringify!(mBRef)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBConstRef as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBConstRef as *const _ as usize + }, 72usize, concat!( "Offset of field: ", @@ -271,7 +290,10 @@ fn bindgen_test_layout_RootedContainer() { concat!("Alignment of ", stringify!(RootedContainer)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).root as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).root as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -316,7 +338,10 @@ fn bindgen_test_layout_PODButContainsDtor() { concat!("Alignment of ", stringify!(PODButContainsDtor)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).member as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -355,7 +380,9 @@ fn bindgen_test_layout_POD() { concat!("Alignment of ", stringify!(POD)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).opaque_member as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).opaque_member as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -564,7 +591,8 @@ fn __bindgen_test_layout_B_open0_ptr_const_mozilla__Foo_close0_instantiation() { ); } #[test] -fn __bindgen_test_layout_B_open0_array1_ptr_const_mozilla__Foo_close0_instantiation() { +fn __bindgen_test_layout_B_open0_array1_ptr_const_mozilla__Foo_close0_instantiation( +) { assert_eq!( ::std::mem::size_of::>(), 8usize, diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs index 9b66adf64e..38a45fd85a 100644 --- a/tests/expectations/tests/template_alias.rs +++ b/tests/expectations/tests/template_alias.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type JS_detail_Wrapped = T; #[repr(C)] diff --git a/tests/expectations/tests/template_alias_basic.rs b/tests/expectations/tests/template_alias_basic.rs index 29f3b7c7cf..f68b9059a8 100644 --- a/tests/expectations/tests/template_alias_basic.rs +++ b/tests/expectations/tests/template_alias_basic.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type Wrapped = T; diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs index dc03a23173..56463f2c8f 100644 --- a/tests/expectations/tests/template_alias_namespace.rs +++ b/tests/expectations/tests/template_alias_namespace.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -20,7 +23,8 @@ pub mod root { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Rooted { pub ptr: root::JS::detail::Wrapped, - pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: + ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { fn default() -> Self { diff --git a/tests/expectations/tests/template_partial_specification.rs b/tests/expectations/tests/template_partial_specification.rs index 5dcc6c4008..d6776794e9 100644 --- a/tests/expectations/tests/template_partial_specification.rs +++ b/tests/expectations/tests/template_partial_specification.rs @@ -1,4 +1,8 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs index 311dd97441..d40e9be324 100644 --- a/tests/expectations/tests/template_typedef_transitive_param.rs +++ b/tests/expectations/tests/template_typedef_transitive_param.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/template_typedefs.rs b/tests/expectations/tests/template_typedefs.rs index df16f9f685..774410b32e 100644 --- a/tests/expectations/tests/template_typedefs.rs +++ b/tests/expectations/tests/template_typedefs.rs @@ -1,10 +1,14 @@ /* automatically generated by rust-bindgen */ +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - - -pub type foo = ::std::option::Option; +pub type foo = + ::std::option::Option; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Foo { @@ -13,5 +17,8 @@ pub struct Foo { pub type Foo_Char = T; pub type Foo_FooPtrTypedef = *mut Foo_Char; pub type Foo_nsCOMArrayEnumFunc = ::std::option::Option< - unsafe extern "C" fn(aElement: *mut T, aData: *mut ::std::os::raw::c_void) -> bool, + unsafe extern "C" fn( + aElement: *mut T, + aData: *mut ::std::os::raw::c_void, + ) -> bool, >; diff --git a/tests/expectations/tests/templateref_opaque.rs b/tests/expectations/tests/templateref_opaque.rs index 481a31bba6..b7900240cf 100644 --- a/tests/expectations/tests/templateref_opaque.rs +++ b/tests/expectations/tests/templateref_opaque.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs index 528a7a2fc2..79f9e4b500 100644 --- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs +++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs @@ -1,10 +1,11 @@ /* automatically generated by rust-bindgen */ extern "C" { - pub static mut foo: - ::std::option::Option< - unsafe extern "C" fn(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) - -> ::std::os::raw::c_int, + pub static mut foo: ::std::option::Option< + unsafe extern "C" fn( + x: ::std::os::raw::c_int, + y: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, >; } pub type Char = ::std::os::raw::c_char; @@ -41,92 +42,47 @@ fn bindgen_test_layout_Test() { assert_eq!( unsafe { &(*(::std::ptr::null::())).ch as *const _ as usize }, 0usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(ch) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).u as *const _ as usize }, 1usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(u) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(u)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, 2usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(d) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(d)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).cch as *const _ as usize }, 3usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(cch) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).cu as *const _ as usize }, 4usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(cu) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).cd as *const _ as usize }, 5usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(cd) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).Cch as *const _ as usize }, 6usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(Cch) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).Cu as *const _ as usize }, 7usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(Cu) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).Cd as *const _ as usize }, 8usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(Cd) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).Ccch as *const _ as usize }, @@ -141,21 +97,11 @@ fn bindgen_test_layout_Test() { assert_eq!( unsafe { &(*(::std::ptr::null::())).Ccu as *const _ as usize }, 10usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(Ccu) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu)) ); assert_eq!( unsafe { &(*(::std::ptr::null::())).Ccd as *const _ as usize }, 11usize, - concat!( - "Offset of field: ", - stringify!(Test), - "::", - stringify!(Ccd) - ) + concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd)) ); } diff --git a/tests/expectations/tests/type-referenced-by-whitelisted-function.rs b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs index 712a850833..0ef64b8840 100644 --- a/tests/expectations/tests/type-referenced-by-whitelisted-function.rs +++ b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -22,7 +25,9 @@ fn bindgen_test_layout_dl_phdr_info() { concat!("Alignment of ", stringify!(dl_phdr_info)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).x as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).x as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/type_alias_empty.rs b/tests/expectations/tests/type_alias_empty.rs index d0f18dedfe..d9a65f9a0a 100644 --- a/tests/expectations/tests/type_alias_empty.rs +++ b/tests/expectations/tests/type_alias_empty.rs @@ -1,7 +1,10 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type bool_constant = u8; diff --git a/tests/expectations/tests/type_alias_partial_template_especialization.rs b/tests/expectations/tests/type_alias_partial_template_especialization.rs index 0a2e80fb2d..53006d28c8 100644 --- a/tests/expectations/tests/type_alias_partial_template_especialization.rs +++ b/tests/expectations/tests/type_alias_partial_template_especialization.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type MaybeWrapped = A; #[repr(C)] diff --git a/tests/expectations/tests/typedefd-array-as-function-arg.rs b/tests/expectations/tests/typedefd-array-as-function-arg.rs index e4e1cba5fa..64b69ba7d8 100644 --- a/tests/expectations/tests/typedefd-array-as-function-arg.rs +++ b/tests/expectations/tests/typedefd-array-as-function-arg.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub type myVector3 = [f32; 3usize]; extern "C" { diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index 3a76d51425..5f651dc164 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -26,7 +26,8 @@ fn bindgen_test_layout_mozilla_FragmentOrURL() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mIsLocalRef as *const _ as usize + &(*(::std::ptr::null::())).mIsLocalRef + as *const _ as usize }, 0usize, concat!( @@ -136,7 +137,8 @@ impl Default for nsFoo { } } #[test] -fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation() { +fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation( +) { assert_eq!( ::std::mem::size_of::(), 8usize, diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index 2f5351a9ed..ae676b5f67 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -66,7 +69,8 @@ fn bindgen_test_layout_mozilla_FragmentOrURL() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mIsLocalRef as *const _ as usize + &(*(::std::ptr::null::())).mIsLocalRef + as *const _ as usize }, 0usize, concat!( @@ -184,7 +188,8 @@ impl Clone for nsFoo { } } #[test] -fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation() { +fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation( +) { assert_eq!( ::std::mem::size_of::(), 8usize, diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs index c4bd288cb4..3404a3f98b 100644 --- a/tests/expectations/tests/underscore.rs +++ b/tests/expectations/tests/underscore.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const __: ::std::os::raw::c_int = 10; #[repr(C)] diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs index b0d3ac9cab..d4bbb740fa 100644 --- a/tests/expectations/tests/union-in-ns.rs +++ b/tests/expectations/tests/union-in-ns.rs @@ -32,7 +32,12 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, 0usize, - concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(bar), + "::", + stringify!(baz) + ) ); } impl Default for bar { diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs index e3a6272ef5..34d9fbf4b7 100644 --- a/tests/expectations/tests/union-in-ns_1_0.rs +++ b/tests/expectations/tests/union-in-ns_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -36,7 +39,10 @@ pub mod root { } impl ::std::marker::Copy for __BindgenUnionField {} impl ::std::fmt::Debug for __BindgenUnionField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fn fmt( + &self, + fmt: &mut ::std::fmt::Formatter<'_>, + ) -> ::std::fmt::Result { fmt.write_str("__BindgenUnionField") } } @@ -72,7 +78,12 @@ pub mod root { assert_eq!( unsafe { &(*(::std::ptr::null::())).baz as *const _ as usize }, 0usize, - concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz)) + concat!( + "Offset of field: ", + stringify!(bar), + "::", + stringify!(baz) + ) ); } impl Clone for bar { diff --git a/tests/expectations/tests/union_bitfield.rs b/tests/expectations/tests/union_bitfield.rs index 3bcd9ba461..9e476099cc 100644 --- a/tests/expectations/tests/union_bitfield.rs +++ b/tests/expectations/tests/union_bitfield.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -115,7 +121,9 @@ impl Default for U4 { impl U4 { #[inline] pub fn derp(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) + } } #[inline] pub fn set_derp(&mut self, val: ::std::os::raw::c_uint) { @@ -125,9 +133,13 @@ impl U4 { } } #[inline] - pub fn new_bitfield_1(derp: ::std::os::raw::c_uint) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + derp: ::std::os::raw::c_uint, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let derp: u32 = unsafe { ::std::mem::transmute(derp) }; derp as u64 @@ -162,7 +174,9 @@ impl Default for B { impl B { #[inline] pub fn foo(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32) + } } #[inline] pub fn set_foo(&mut self, val: ::std::os::raw::c_uint) { @@ -173,7 +187,9 @@ impl B { } #[inline] pub fn bar(&self) -> ::std::os::raw::c_uchar { - unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) + } } #[inline] pub fn set_bar(&mut self, val: ::std::os::raw::c_uchar) { @@ -187,8 +203,10 @@ impl B { foo: ::std::os::raw::c_uint, bar: ::std::os::raw::c_uchar, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 31u8, { let foo: u32 = unsafe { ::std::mem::transmute(foo) }; foo as u64 diff --git a/tests/expectations/tests/union_bitfield_1_0.rs b/tests/expectations/tests/union_bitfield_1_0.rs index c875538114..efc7dfebc6 100644 --- a/tests/expectations/tests/union_bitfield_1_0.rs +++ b/tests/expectations/tests/union_bitfield_1_0.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -134,7 +140,8 @@ impl ::std::cmp::Eq for __BindgenUnionField {} #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct U4 { - pub _bitfield_1: __BindgenUnionField<__BindgenBitfieldUnit<[u8; 1usize], u8>>, + pub _bitfield_1: + __BindgenUnionField<__BindgenBitfieldUnit<[u8; 1usize], u8>>, pub bindgen_union_field: u32, } #[test] @@ -158,7 +165,11 @@ impl Clone for U4 { impl U4 { #[inline] pub fn derp(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.as_ref().get(0usize, 1u8) as u32) } + unsafe { + ::std::mem::transmute( + self._bitfield_1.as_ref().get(0usize, 1u8) as u32 + ) + } } #[inline] pub fn set_derp(&mut self, val: ::std::os::raw::c_uint) { @@ -168,9 +179,13 @@ impl U4 { } } #[inline] - pub fn new_bitfield_1(derp: ::std::os::raw::c_uint) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); + pub fn new_bitfield_1( + derp: ::std::os::raw::c_uint, + ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 1usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { let derp: u32 = unsafe { ::std::mem::transmute(derp) }; derp as u64 @@ -181,7 +196,8 @@ impl U4 { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B { - pub _bitfield_1: __BindgenUnionField<__BindgenBitfieldUnit<[u8; 4usize], u32>>, + pub _bitfield_1: + __BindgenUnionField<__BindgenBitfieldUnit<[u8; 4usize], u32>>, pub bindgen_union_field: u32, } #[test] @@ -205,7 +221,11 @@ impl Clone for B { impl B { #[inline] pub fn foo(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.as_ref().get(0usize, 31u8) as u32) } + unsafe { + ::std::mem::transmute( + self._bitfield_1.as_ref().get(0usize, 31u8) as u32 + ) + } } #[inline] pub fn set_foo(&mut self, val: ::std::os::raw::c_uint) { @@ -216,7 +236,11 @@ impl B { } #[inline] pub fn bar(&self) -> ::std::os::raw::c_uchar { - unsafe { ::std::mem::transmute(self._bitfield_1.as_ref().get(31usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute( + self._bitfield_1.as_ref().get(31usize, 1u8) as u8 + ) + } } #[inline] pub fn set_bar(&mut self, val: ::std::os::raw::c_uchar) { @@ -230,8 +254,10 @@ impl B { foo: ::std::os::raw::c_uint, bar: ::std::os::raw::c_uchar, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 31u8, { let foo: u32 = unsafe { ::std::mem::transmute(foo) }; foo as u64 @@ -246,7 +272,8 @@ impl B { #[repr(C)] #[derive(Copy)] pub struct HasBigBitfield { - pub _bitfield_1: __BindgenUnionField<__BindgenBitfieldUnit<[u8; 16usize], u64>>, + pub _bitfield_1: + __BindgenUnionField<__BindgenBitfieldUnit<[u8; 16usize], u64>>, pub bindgen_union_field: [u8; 16usize], } #[test] diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs index 1a3ad7161a..3a24fc4a06 100644 --- a/tests/expectations/tests/union_dtor.rs +++ b/tests/expectations/tests/union_dtor.rs @@ -26,7 +26,9 @@ fn bindgen_test_layout_UnionWithDtor() { concat!("Alignment of ", stringify!(UnionWithDtor)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFoo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFoo as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -36,7 +38,9 @@ fn bindgen_test_layout_UnionWithDtor() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs index 0814b7804a..0463bc964a 100644 --- a/tests/expectations/tests/union_dtor_1_0.rs +++ b/tests/expectations/tests/union_dtor_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -67,7 +70,9 @@ fn bindgen_test_layout_UnionWithDtor() { concat!("Alignment of ", stringify!(UnionWithDtor)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFoo as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFoo as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -77,7 +82,9 @@ fn bindgen_test_layout_UnionWithDtor() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mBar as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mBar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs index e6f4e22965..148c19ab1f 100644 --- a/tests/expectations/tests/union_fields.rs +++ b/tests/expectations/tests/union_fields.rs @@ -28,7 +28,9 @@ fn bindgen_test_layout_nsStyleUnion() { concat!("Alignment of ", stringify!(nsStyleUnion)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mInt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mInt as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -38,7 +40,9 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFloat as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFloat as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -48,7 +52,10 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mPointer as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mPointer as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs index 6da625d110..0068f97abd 100644 --- a/tests/expectations/tests/union_fields_1_0.rs +++ b/tests/expectations/tests/union_fields_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -68,7 +71,9 @@ fn bindgen_test_layout_nsStyleUnion() { concat!("Alignment of ", stringify!(nsStyleUnion)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mInt as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mInt as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -78,7 +83,9 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFloat as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFloat as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -88,7 +95,10 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mPointer as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mPointer as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_template_1_0.rs b/tests/expectations/tests/union_template_1_0.rs index a5ab798456..370d27174b 100644 --- a/tests/expectations/tests/union_template_1_0.rs +++ b/tests/expectations/tests/union_template_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs index a145133277..b42063becd 100644 --- a/tests/expectations/tests/union_with_anon_struct.rs +++ b/tests/expectations/tests/union_with_anon_struct.rs @@ -32,7 +32,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -42,7 +44,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs index 2638fa5a66..0f53d17ed3 100644 --- a/tests/expectations/tests/union_with_anon_struct_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -72,7 +75,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -82,7 +87,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs index d8aaf22191..46a4bb520d 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -117,7 +123,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { impl foo__bindgen_ty_1 { #[inline] pub fn b(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u32) + } } #[inline] pub fn set_b(&mut self, val: ::std::os::raw::c_int) { @@ -128,7 +136,9 @@ impl foo__bindgen_ty_1 { } #[inline] pub fn c(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) + } } #[inline] pub fn set_c(&mut self, val: ::std::os::raw::c_int) { @@ -142,8 +152,10 @@ impl foo__bindgen_ty_1 { b: ::std::os::raw::c_int, c: ::std::os::raw::c_int, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 7u8, { let b: u32 = unsafe { ::std::mem::transmute(b) }; b as u64 diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs index 2895a391ec..89047eca59 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -165,7 +171,9 @@ impl Clone for foo__bindgen_ty_1 { impl foo__bindgen_ty_1 { #[inline] pub fn b(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u32) + } } #[inline] pub fn set_b(&mut self, val: ::std::os::raw::c_int) { @@ -176,7 +184,9 @@ impl foo__bindgen_ty_1 { } #[inline] pub fn c(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) + } } #[inline] pub fn set_c(&mut self, val: ::std::os::raw::c_int) { @@ -190,8 +200,10 @@ impl foo__bindgen_ty_1 { b: ::std::os::raw::c_int, c: ::std::os::raw::c_int, ) -> __BindgenBitfieldUnit<[u8; 4usize], u32> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u32> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u32, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 7u8, { let b: u32 = unsafe { ::std::mem::transmute(b) }; b as u64 diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs index aa2abc864d..bf4775b1a0 100644 --- a/tests/expectations/tests/union_with_anon_union.rs +++ b/tests/expectations/tests/union_with_anon_union.rs @@ -33,7 +33,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -43,7 +45,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs index 8e6c01eeb0..722ee4d6f7 100644 --- a/tests/expectations/tests/union_with_anon_union_1_0.rs +++ b/tests/expectations/tests/union_with_anon_union_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -73,7 +76,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -83,7 +88,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs index a1267b3952..00887d1110 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs @@ -35,7 +35,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { concat!("Alignment of ", stringify!(pixel__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).r as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -45,7 +48,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).g as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).g as *const _ + as usize + }, 1usize, concat!( "Offset of field: ", @@ -55,7 +61,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 2usize, concat!( "Offset of field: ", @@ -65,7 +74,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 3usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs index 80c83acbc5..dc9ff2cb9f 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -75,7 +78,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { concat!("Alignment of ", stringify!(pixel__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).r as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).r as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -85,7 +91,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).g as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).g as *const _ + as usize + }, 1usize, concat!( "Offset of field: ", @@ -95,7 +104,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ + as usize + }, 2usize, concat!( "Offset of field: ", @@ -105,7 +117,10 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ + as usize + }, 3usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs index c6272c1332..ab729ea251 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_union.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs @@ -34,7 +34,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -44,7 +46,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs index bda49e2409..beb151d655 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -74,7 +77,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -84,7 +89,9 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).c as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs index c31a69f94f..5b459d3c5a 100644 --- a/tests/expectations/tests/union_with_big_member.rs +++ b/tests/expectations/tests/union_with_big_member.rs @@ -27,7 +27,9 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -37,7 +39,9 @@ fn bindgen_test_layout_WithBigArray() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -72,7 +76,9 @@ fn bindgen_test_layout_WithBigArray2() { concat!("Alignment of ", stringify!(WithBigArray2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -82,7 +88,9 @@ fn bindgen_test_layout_WithBigArray2() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -117,7 +125,9 @@ fn bindgen_test_layout_WithBigMember() { concat!("Alignment of ", stringify!(WithBigMember)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -127,7 +137,9 @@ fn bindgen_test_layout_WithBigMember() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs index c636c8e562..31fc746592 100644 --- a/tests/expectations/tests/union_with_big_member_1_0.rs +++ b/tests/expectations/tests/union_with_big_member_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -67,7 +70,9 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -77,7 +82,9 @@ fn bindgen_test_layout_WithBigArray() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -117,7 +124,9 @@ fn bindgen_test_layout_WithBigArray2() { concat!("Alignment of ", stringify!(WithBigArray2)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -127,7 +136,9 @@ fn bindgen_test_layout_WithBigArray2() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -162,7 +173,9 @@ fn bindgen_test_layout_WithBigMember() { concat!("Alignment of ", stringify!(WithBigMember)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -172,7 +185,9 @@ fn bindgen_test_layout_WithBigMember() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).b as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs index 0a4fd91cbe..eeefa6afa5 100644 --- a/tests/expectations/tests/union_with_nesting.rs +++ b/tests/expectations/tests/union_with_nesting.rs @@ -41,7 +41,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).b1 as *const _ as usize + &(*(::std::ptr::null::())).b1 + as *const _ as usize }, 0usize, concat!( @@ -53,7 +54,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).b2 as *const _ as usize + &(*(::std::ptr::null::())).b2 + as *const _ as usize }, 0usize, concat!( @@ -90,7 +92,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c1 as *const _ as usize + &(*(::std::ptr::null::())).c1 + as *const _ as usize }, 0usize, concat!( @@ -102,7 +105,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c2 as *const _ as usize + &(*(::std::ptr::null::())).c2 + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs index b9fc908fe3..1ae7d31fdc 100644 --- a/tests/expectations/tests/union_with_nesting_1_0.rs +++ b/tests/expectations/tests/union_with_nesting_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct __BindgenUnionField(::std::marker::PhantomData); @@ -81,7 +84,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).b1 as *const _ as usize + &(*(::std::ptr::null::())).b1 + as *const _ as usize }, 0usize, concat!( @@ -93,7 +97,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).b2 as *const _ as usize + &(*(::std::ptr::null::())).b2 + as *const _ as usize }, 0usize, concat!( @@ -130,7 +135,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c1 as *const _ as usize + &(*(::std::ptr::null::())).c1 + as *const _ as usize }, 0usize, concat!( @@ -142,7 +148,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).c2 as *const _ as usize + &(*(::std::ptr::null::())).c2 + as *const _ as usize }, 0usize, concat!( diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs index a11f105a3a..d7c8134c68 100644 --- a/tests/expectations/tests/unknown_attr.rs +++ b/tests/expectations/tests/unknown_attr.rs @@ -30,7 +30,8 @@ fn bindgen_test_layout_max_align_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize + &(*(::std::ptr::null::())).__clang_max_align_nonce1 + as *const _ as usize }, 0usize, concat!( @@ -42,7 +43,8 @@ fn bindgen_test_layout_max_align_t() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize + &(*(::std::ptr::null::())).__clang_max_align_nonce2 + as *const _ as usize }, 16usize, concat!( diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs index a2dfc97fa3..04a0f0a7b8 100644 --- a/tests/expectations/tests/use-core.rs +++ b/tests/expectations/tests/use-core.rs @@ -69,7 +69,9 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -79,7 +81,9 @@ fn bindgen_test_layout__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -97,4 +101,5 @@ impl Default for _bindgen_ty_1 { extern "C" { pub static mut bazz: _bindgen_ty_1; } -pub type fooFunction = ::core::option::Option; +pub type fooFunction = + ::core::option::Option; diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs index ce17d3bca7..5551800608 100644 --- a/tests/expectations/tests/use-core_1_0.rs +++ b/tests/expectations/tests/use-core_1_0.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern crate core; @@ -113,7 +117,9 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -123,7 +129,9 @@ fn bindgen_test_layout__bindgen_ty_1() { ) ); assert_eq!( - unsafe { &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize }, + unsafe { + &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -141,4 +149,5 @@ impl Clone for _bindgen_ty_1 { extern "C" { pub static mut bazz: _bindgen_ty_1; } -pub type fooFunction = ::core::option::Option; +pub type fooFunction = + ::core::option::Option; diff --git a/tests/expectations/tests/using.rs b/tests/expectations/tests/using.rs index 9bc5e303d4..bc30c5d472 100644 --- a/tests/expectations/tests/using.rs +++ b/tests/expectations/tests/using.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs index 03b23eadb6..214f10f8ca 100644 --- a/tests/expectations/tests/var-tracing.rs +++ b/tests/expectations/tests/var-tracing.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/variadic-method.rs b/tests/expectations/tests/variadic-method.rs index 94dd73bee0..ff62aa226c 100644 --- a/tests/expectations/tests/variadic-method.rs +++ b/tests/expectations/tests/variadic-method.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] extern "C" { #[link_name = "\u{1}_Z3fooPKcz"] diff --git a/tests/expectations/tests/variadic_template_function.rs b/tests/expectations/tests/variadic_template_function.rs index e14da64f33..2b3ae2b46a 100644 --- a/tests/expectations/tests/variadic_template_function.rs +++ b/tests/expectations/tests/variadic_template_function.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/virtual_dtor.rs b/tests/expectations/tests/virtual_dtor.rs index 9183090899..486de8c691 100644 --- a/tests/expectations/tests/virtual_dtor.rs +++ b/tests/expectations/tests/virtual_dtor.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct nsSlots__bindgen_vtable(::std::os::raw::c_void); diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs index ed5d115157..4da4170413 100644 --- a/tests/expectations/tests/virtual_inheritance.rs +++ b/tests/expectations/tests/virtual_inheritance.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs index 376bae8a84..f55b5153b9 100644 --- a/tests/expectations/tests/virtual_overloaded.rs +++ b/tests/expectations/tests/virtual_overloaded.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct C__bindgen_vtable(::std::os::raw::c_void); @@ -31,9 +34,15 @@ impl Default for C { } extern "C" { #[link_name = "\u{1}_ZN1C8do_thingEc"] - pub fn C_do_thing(this: *mut ::std::os::raw::c_void, arg1: ::std::os::raw::c_char); + pub fn C_do_thing( + this: *mut ::std::os::raw::c_void, + arg1: ::std::os::raw::c_char, + ); } extern "C" { #[link_name = "\u{1}_ZN1C8do_thingEi"] - pub fn C_do_thing1(this: *mut ::std::os::raw::c_void, arg1: ::std::os::raw::c_int); + pub fn C_do_thing1( + this: *mut ::std::os::raw::c_void, + arg1: ::std::os::raw::c_int, + ); } diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs index f0720f2735..90d8b0e394 100644 --- a/tests/expectations/tests/vtable_recursive_sig.rs +++ b/tests/expectations/tests/vtable_recursive_sig.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] pub struct Base__bindgen_vtable(::std::os::raw::c_void); diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs index a91aae684f..b786198ce1 100644 --- a/tests/expectations/tests/weird_bitfields.rs +++ b/tests/expectations/tests/weird_bitfields.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -127,7 +133,10 @@ fn bindgen_test_layout_Weird() { concat!("Alignment of ", stringify!(Weird)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mStrokeDasharrayLength as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mStrokeDasharrayLength as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", @@ -137,7 +146,9 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mClipRule as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mClipRule as *const _ as usize + }, 8usize, concat!( "Offset of field: ", @@ -147,7 +158,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mColorInterpolation as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mColorInterpolation as *const _ + as usize + }, 9usize, concat!( "Offset of field: ", @@ -158,7 +172,8 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - &(*(::std::ptr::null::())).mColorInterpolationFilters as *const _ as usize + &(*(::std::ptr::null::())).mColorInterpolationFilters + as *const _ as usize }, 10usize, concat!( @@ -169,7 +184,9 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mFillRule as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mFillRule as *const _ as usize + }, 11usize, concat!( "Offset of field: ", @@ -179,7 +196,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mImageRendering as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mImageRendering as *const _ + as usize + }, 12usize, concat!( "Offset of field: ", @@ -189,7 +209,9 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mPaintOrder as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mPaintOrder as *const _ as usize + }, 13usize, concat!( "Offset of field: ", @@ -199,7 +221,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mShapeRendering as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mShapeRendering as *const _ + as usize + }, 14usize, concat!( "Offset of field: ", @@ -209,7 +234,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mStrokeLinecap as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mStrokeLinecap as *const _ + as usize + }, 15usize, concat!( "Offset of field: ", @@ -219,7 +247,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mStrokeLinejoin as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mStrokeLinejoin as *const _ + as usize + }, 16usize, concat!( "Offset of field: ", @@ -229,7 +260,9 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mTextAnchor as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mTextAnchor as *const _ as usize + }, 17usize, concat!( "Offset of field: ", @@ -239,7 +272,10 @@ fn bindgen_test_layout_Weird() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).mTextRendering as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).mTextRendering as *const _ + as usize + }, 18usize, concat!( "Offset of field: ", @@ -257,7 +293,9 @@ impl Default for Weird { impl Weird { #[inline] pub fn bitTest(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) + } } #[inline] pub fn set_bitTest(&mut self, val: ::std::os::raw::c_uint) { @@ -268,7 +306,9 @@ impl Weird { } #[inline] pub fn bitTest2(&self) -> ::std::os::raw::c_uint { - unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 15u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(16usize, 15u8) as u32) + } } #[inline] pub fn set_bitTest2(&mut self, val: ::std::os::raw::c_uint) { @@ -282,8 +322,10 @@ impl Weird { bitTest: ::std::os::raw::c_uint, bitTest2: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 4usize], u16> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u16> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 4usize], + u16, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 16u8, { let bitTest: u32 = unsafe { ::std::mem::transmute(bitTest) }; bitTest as u64 @@ -296,7 +338,9 @@ impl Weird { } #[inline] pub fn mFillOpacitySource(&self) -> nsStyleSVGOpacitySource { - unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 3u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(0usize, 3u8) as u32) + } } #[inline] pub fn set_mFillOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { @@ -307,7 +351,9 @@ impl Weird { } #[inline] pub fn mStrokeOpacitySource(&self) -> nsStyleSVGOpacitySource { - unsafe { ::std::mem::transmute(self._bitfield_2.get(3usize, 3u8) as u32) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(3usize, 3u8) as u32) + } } #[inline] pub fn set_mStrokeOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { @@ -318,7 +364,9 @@ impl Weird { } #[inline] pub fn mStrokeDasharrayFromObject(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_2.get(6usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(6usize, 1u8) as u8) + } } #[inline] pub fn set_mStrokeDasharrayFromObject(&mut self, val: bool) { @@ -329,7 +377,9 @@ impl Weird { } #[inline] pub fn mStrokeDashoffsetFromObject(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_2.get(7usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(7usize, 1u8) as u8) + } } #[inline] pub fn set_mStrokeDashoffsetFromObject(&mut self, val: bool) { @@ -340,7 +390,9 @@ impl Weird { } #[inline] pub fn mStrokeWidthFromObject(&self) -> bool { - unsafe { ::std::mem::transmute(self._bitfield_2.get(8usize, 1u8) as u8) } + unsafe { + ::std::mem::transmute(self._bitfield_2.get(8usize, 1u8) as u8) + } } #[inline] pub fn set_mStrokeWidthFromObject(&mut self, val: bool) { @@ -357,14 +409,18 @@ impl Weird { mStrokeDashoffsetFromObject: bool, mStrokeWidthFromObject: bool, ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = - Default::default(); + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 2usize], + u8, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 3u8, { - let mFillOpacitySource: u32 = unsafe { ::std::mem::transmute(mFillOpacitySource) }; + let mFillOpacitySource: u32 = + unsafe { ::std::mem::transmute(mFillOpacitySource) }; mFillOpacitySource as u64 }); __bindgen_bitfield_unit.set(3usize, 3u8, { - let mStrokeOpacitySource: u32 = unsafe { ::std::mem::transmute(mStrokeOpacitySource) }; + let mStrokeOpacitySource: u32 = + unsafe { ::std::mem::transmute(mStrokeOpacitySource) }; mStrokeOpacitySource as u64 }); __bindgen_bitfield_unit.set(6usize, 1u8, { diff --git a/tests/expectations/tests/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs index d0e4c689c7..8c954c4c53 100644 --- a/tests/expectations/tests/what_is_going_on.rs +++ b/tests/expectations/tests/what_is_going_on.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/whitelist-namespaces-basic.rs b/tests/expectations/tests/whitelist-namespaces-basic.rs index 74c782f77c..39ad1ed6ee 100644 --- a/tests/expectations/tests/whitelist-namespaces-basic.rs +++ b/tests/expectations/tests/whitelist-namespaces-basic.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { diff --git a/tests/expectations/tests/whitelist-namespaces.rs b/tests/expectations/tests/whitelist-namespaces.rs index cd179ca74c..6f36034b54 100644 --- a/tests/expectations/tests/whitelist-namespaces.rs +++ b/tests/expectations/tests/whitelist-namespaces.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod root { @@ -51,7 +54,9 @@ pub mod root { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).helper as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).helper as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs index 7ff1160dad..0fa97eab92 100644 --- a/tests/expectations/tests/whitelist_basic.rs +++ b/tests/expectations/tests/whitelist_basic.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/whitelist_fix.rs b/tests/expectations/tests/whitelist_fix.rs index ed30347cc0..a14b0e56da 100644 --- a/tests/expectations/tests/whitelist_fix.rs +++ b/tests/expectations/tests/whitelist_fix.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub enum Test {} diff --git a/tests/expectations/tests/whitelist_vars.rs b/tests/expectations/tests/whitelist_vars.rs index b8f1099825..29cb73897b 100644 --- a/tests/expectations/tests/whitelist_vars.rs +++ b/tests/expectations/tests/whitelist_vars.rs @@ -1,6 +1,11 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] pub const NONE: u32 = 0; pub const FOO: u32 = 5; diff --git a/tests/expectations/tests/whitelisted-item-references-no-hash.rs b/tests/expectations/tests/whitelisted-item-references-no-hash.rs index bf6eda64ed..3a5655bf96 100644 --- a/tests/expectations/tests/whitelisted-item-references-no-hash.rs +++ b/tests/expectations/tests/whitelisted-item-references-no-hash.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -40,7 +43,9 @@ fn bindgen_test_layout_WhitelistMe() { concat!("Alignment of ", stringify!(WhitelistMe)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs index cfcbf5a458..4e1ee2de4c 100644 --- a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs +++ b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -40,7 +43,9 @@ fn bindgen_test_layout_WhitelistMe() { concat!("Alignment of ", stringify!(WhitelistMe)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/whitelisted_item_references_no_copy.rs b/tests/expectations/tests/whitelisted_item_references_no_copy.rs index 2e635dc2c8..2a4bfa600b 100644 --- a/tests/expectations/tests/whitelisted_item_references_no_copy.rs +++ b/tests/expectations/tests/whitelisted_item_references_no_copy.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default)] @@ -40,7 +43,9 @@ fn bindgen_test_layout_WhitelistMe() { concat!("Alignment of ", stringify!(WhitelistMe)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).a as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).a as *const _ as usize + }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/win32-thiscall_1_0.rs b/tests/expectations/tests/win32-thiscall_1_0.rs index f84a70055b..e9c5d9769d 100644 --- a/tests/expectations/tests/win32-thiscall_1_0.rs +++ b/tests/expectations/tests/win32-thiscall_1_0.rs @@ -1,8 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #[repr(C)] #[derive(Debug, Default, Copy)] diff --git a/tests/expectations/tests/win32-thiscall_nightly.rs b/tests/expectations/tests/win32-thiscall_nightly.rs index 3b0140dcbf..a135b63f44 100644 --- a/tests/expectations/tests/win32-thiscall_nightly.rs +++ b/tests/expectations/tests/win32-thiscall_nightly.rs @@ -1,7 +1,11 @@ /* automatically generated by rust-bindgen */ - -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] #![cfg(feature = "nightly")] #![feature(abi_thiscall)] @@ -29,7 +33,10 @@ extern "thiscall" { } extern "thiscall" { #[link_name = "\u{1}?test2@Foo@@QAEHH@Z"] - pub fn Foo_test2(this: *mut Foo, var: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn Foo_test2( + this: *mut Foo, + var: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } impl Foo { #[inline] @@ -37,7 +44,10 @@ impl Foo { Foo_test(self) } #[inline] - pub unsafe fn test2(&mut self, var: ::std::os::raw::c_int) -> ::std::os::raw::c_int { + pub unsafe fn test2( + &mut self, + var: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { Foo_test2(self, var) } } diff --git a/tests/expectations/tests/with_array_pointers_arguments.rs b/tests/expectations/tests/with_array_pointers_arguments.rs index 3808e18be4..9c7b225b6e 100644 --- a/tests/expectations/tests/with_array_pointers_arguments.rs +++ b/tests/expectations/tests/with_array_pointers_arguments.rs @@ -8,10 +8,16 @@ )] extern "C" { - pub fn test_fn(a: f32, arr: *mut [::std::os::raw::c_int; 20usize]) -> ::std::os::raw::c_int; + pub fn test_fn( + a: f32, + arr: *mut [::std::os::raw::c_int; 20usize], + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn test_fn2(arr: *const [f32; 20usize], b: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn test_fn2( + arr: *const [f32; 20usize], + b: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } pub type defArr = [::std::os::raw::c_char; 20usize]; pub type foo = ::std::option::Option; diff --git a/tests/expectations/tests/without_array_pointers_arguments.rs b/tests/expectations/tests/without_array_pointers_arguments.rs index b616893707..4221fc0c4c 100644 --- a/tests/expectations/tests/without_array_pointers_arguments.rs +++ b/tests/expectations/tests/without_array_pointers_arguments.rs @@ -8,13 +8,20 @@ )] extern "C" { - pub fn test_fn(a: f32, arr: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn test_fn( + a: f32, + arr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn test_fn2(arr: *const f32, b: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn test_fn2( + arr: *const f32, + b: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } pub type defArr = [::std::os::raw::c_char; 20usize]; -pub type foo = ::std::option::Option; +pub type foo = + ::std::option::Option; extern "C" { pub fn bar(a: *mut ::std::os::raw::c_char); } diff --git a/tests/expectations/tests/zero-size-array-align.rs b/tests/expectations/tests/zero-size-array-align.rs index 1debdaea47..f17647d130 100644 --- a/tests/expectations/tests/zero-size-array-align.rs +++ b/tests/expectations/tests/zero-size-array-align.rs @@ -63,7 +63,9 @@ fn bindgen_test_layout_dm_deps() { concat!("Alignment of ", stringify!(dm_deps)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).count as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -73,7 +75,9 @@ fn bindgen_test_layout_dm_deps() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).filler as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).filler as *const _ as usize + }, 4usize, concat!( "Offset of field: ", @@ -83,7 +87,9 @@ fn bindgen_test_layout_dm_deps() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).device as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).device as *const _ as usize + }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/zero-sized-array.rs b/tests/expectations/tests/zero-sized-array.rs index c0b989c8e3..7dee6fb211 100644 --- a/tests/expectations/tests/zero-sized-array.rs +++ b/tests/expectations/tests/zero-sized-array.rs @@ -62,7 +62,9 @@ fn bindgen_test_layout_ZeroSizedArray() { concat!("Alignment of ", stringify!(ZeroSizedArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).arr as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).arr as *const _ as usize + }, 0usize, concat!( "Offset of field: ", @@ -91,7 +93,10 @@ fn bindgen_test_layout_ContainsZeroSizedArray() { concat!("Alignment of ", stringify!(ContainsZeroSizedArray)) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).zsa as *const _ as usize }, + unsafe { + &(*(::std::ptr::null::())).zsa as *const _ + as usize + }, 0usize, concat!( "Offset of field: ", From 313846fe5d2a10a3fbfc5325a4a0e8e9b8856a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:17:21 +0200 Subject: [PATCH 11/15] Run `cargo fmt` on the main crate. --- src/clang.rs | 12 +++++++----- src/ir/context.rs | 4 ++-- src/ir/dot.rs | 6 +----- src/main.rs | 5 ++++- src/options.rs | 9 +++++++-- tests/tests.rs | 21 ++++++++++++++------- 6 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/clang.rs b/src/clang.rs index efb5307425..4bcc4b4ac4 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -543,10 +543,10 @@ impl Cursor { let kind = cur.kind(); found_attr = clang_kind.map_or(false, |k| k == kind) || (kind == CXCursor_UnexposedAttr && - cur.tokens().iter().any(|t| { - t.kind == CXToken_Identifier && - t.spelling() == name.as_bytes() - })); + cur.tokens().iter().any(|t| { + t.kind == CXToken_Identifier && + t.spelling() == name.as_bytes() + })); if found_attr { CXChildVisit_Break @@ -733,7 +733,9 @@ impl Cursor { if file.is_null() { None } else { - Some(unsafe { cxstring_into_string(clang_sys::clang_getFileName(file)) }) + Some(unsafe { + cxstring_into_string(clang_sys::clang_getFileName(file)) + }) } } } diff --git a/src/ir/context.rs b/src/ir/context.rs index 6158d02d6e..127c0a24f0 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -553,8 +553,8 @@ impl BindgenContext { clang_sys::CXTranslationUnit_DetailedPreprocessingRecord; let translation_unit = { - let _t = Timer::new("translation_unit") - .with_output(options.time_phases); + let _t = + Timer::new("translation_unit").with_output(options.time_phases); let clang_args = if explicit_target { Cow::Borrowed(&options.clang_args) } else { diff --git a/src/ir/dot.rs b/src/ir/dot.rs index d56902321d..6bf75bfa77 100644 --- a/src/ir/dot.rs +++ b/src/ir/dot.rs @@ -38,11 +38,7 @@ where &mut dot_file, r#"{} [fontname="courier", color={}, label=< "#, id.as_usize(), - if is_whitelisted { - "black" - } else { - "gray" - } + if is_whitelisted { "black" } else { "gray" } )?; item.dot_attributes(ctx, &mut dot_file)?; writeln!(&mut dot_file, r#"
>];"#)?; diff --git a/src/main.rs b/src/main.rs index 2c32d3cbef..ad0915e403 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,10 @@ pub fn main() { None }; - info!("Clang Version: {}, parsed: {:?}", version.full, version.parsed); + info!( + "Clang Version: {}, parsed: {:?}", + version.full, version.parsed + ); if expected_version.is_some() { assert_eq!(version.parsed, version.parsed); diff --git a/src/options.rs b/src/options.rs index 6ead924141..d244aafbb0 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,4 +1,7 @@ -use bindgen::{builder, Builder, CodegenConfig, EnumVariation, RustTarget, RUST_TARGET_STRINGS}; +use bindgen::{ + builder, Builder, CodegenConfig, EnumVariation, RustTarget, + RUST_TARGET_STRINGS, +}; use clap::{App, Arg}; use std::fs::File; use std::io::{self, stderr, Error, ErrorKind, Write}; @@ -6,7 +9,9 @@ use std::path::PathBuf; use std::str::FromStr; /// Construct a new [`Builder`](./struct.Builder.html) from command line flags. -pub fn builder_from_flags(args: I) -> Result<(Builder, Box, bool), io::Error> +pub fn builder_from_flags( + args: I, +) -> Result<(Builder, Box, bool), io::Error> where I: Iterator, { diff --git a/tests/tests.rs b/tests/tests.rs index a6c8f4a0ff..01e90be837 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -68,12 +68,14 @@ The latest `rustfmt` is required to run the `bindgen` test suite. Install // Write to stdin in a new thread, so that we can read from stdout on this // thread. This keeps the child from blocking on writing to its stdout which // might block us from writing to its stdin. - let stdin_handle = ::std::thread::spawn(move || stdin.write_all(source.as_bytes())); + let stdin_handle = + ::std::thread::spawn(move || stdin.write_all(source.as_bytes())); // Read stderr on a new thread for similar reasons. let stderr_handle = ::std::thread::spawn(move || { let mut output = vec![]; - io::copy(&mut stderr, &mut output).map(|_| String::from_utf8_lossy(&output).to_string()) + io::copy(&mut stderr, &mut output) + .map(|_| String::from_utf8_lossy(&output).to_string()) }); let mut output = vec![]; @@ -88,7 +90,8 @@ The latest `rustfmt` is required to run the `bindgen` test suite. Install .expect("writer thread should not have panicked") .expect("should have written to child rustfmt's stdin OK"); - let bindings = String::from_utf8(output).expect("rustfmt should only emit valid utf-8"); + let bindings = String::from_utf8(output) + .expect("rustfmt should only emit valid utf-8"); let stderr = stderr_handle .join() @@ -98,7 +101,10 @@ The latest `rustfmt` is required to run the `bindgen` test suite. Install (bindings, stderr) } -fn compare_generated_header(header: &PathBuf, builder: Builder) -> Result<(), Error> { +fn compare_generated_header( + header: &PathBuf, + builder: Builder, +) -> Result<(), Error> { let file_name = header.file_name().ok_or(Error::new( ErrorKind::Other, "compare_generated_header expects a file", @@ -256,8 +262,8 @@ fn create_bindgen_builder(header: &PathBuf) -> Result, Error> { .map(ToString::to_string) .chain(flags) .collect(); - } else if line.contains("bindgen-generate-bindings-on-linux-only") - && !cfg!(target_os = "linux") + } else if line.contains("bindgen-generate-bindings-on-linux-only") && + !cfg!(target_os = "linux") { return Ok(None); } @@ -442,7 +448,8 @@ fn no_system_header_includes() { #[test] fn dump_preprocessed_input() { - let arg_keyword = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/arg_keyword.hpp"); + let arg_keyword = + concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/arg_keyword.hpp"); let empty_layout = concat!( env!("CARGO_MANIFEST_DIR"), "/tests/headers/cpp-empty-layout.hpp" From 73b0c905c8619ddd99fa727170156a6d9ed7fc54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:17:28 +0200 Subject: [PATCH 12/15] Enforce rustfmt on automation. --- ci/script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index 73c5614b54..9aec9c6602 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -45,8 +45,7 @@ case "$BINDGEN_JOB" in ./ci/assert-docs.sh ./ci/test-book.sh ./ci/no-includes.sh - # Disabled because https://github.com/rust-lang/rustfmt/issues/3799. - # ./ci/assert-rustfmt.sh + ./ci/assert-rustfmt.sh ;; "quickchecking") From c7f77841771ce921c25eb6f526c37e13d1de790e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:20:17 +0200 Subject: [PATCH 13/15] tests: Remove support for test directive that is no longer used. ae0fdf7a5519a175d887389c80399234637bdc29 changed the setup for the only test that actually used this. --- tests/tests.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index 01e90be837..1fe8a1ec63 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -262,10 +262,6 @@ fn create_bindgen_builder(header: &PathBuf) -> Result, Error> { .map(ToString::to_string) .chain(flags) .collect(); - } else if line.contains("bindgen-generate-bindings-on-linux-only") && - !cfg!(target_os = "linux") - { - return Ok(None); } } From 12777a423979595d67dd912d3778acf55319ceac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Oct 2019 16:25:37 +0200 Subject: [PATCH 14/15] bindgen-integration: Reformat crate too. Cleanup a bit the reformatted bits while at it. --- bindgen-integration/build.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs index d9be232ba7..38c5849776 100644 --- a/bindgen-integration/build.rs +++ b/bindgen-integration/build.rs @@ -44,10 +44,10 @@ impl ParseCallbacks for MacroCallback { } fn str_macro(&self, name: &str, value: &[u8]) { - match &name { - &"TESTMACRO_STRING_EXPANDED" - | &"TESTMACRO_STRING" - | &"TESTMACRO_INTEGER" => { + match name { + "TESTMACRO_STRING_EXPANDED" | + "TESTMACRO_STRING" | + "TESTMACRO_INTEGER" => { // The integer test macro is, actually, not expected to show up here at all -- but // should produce an error if it does. assert_eq!( From 2d9dceb262d532536de800dfc2778c04eb9d8f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 14 Oct 2019 14:13:31 +0200 Subject: [PATCH 15/15] Fix bitfield-linux-32.hpp to not hit #1538. The test was failing. --- tests/expectations/tests/bitfield-linux-32.rs | 38 ++++++++++++++----- tests/headers/bitfield-linux-32.hpp | 1 + 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/tests/expectations/tests/bitfield-linux-32.rs b/tests/expectations/tests/bitfield-linux-32.rs index 8b6d53060d..3b63a57760 100644 --- a/tests/expectations/tests/bitfield-linux-32.rs +++ b/tests/expectations/tests/bitfield-linux-32.rs @@ -57,7 +57,10 @@ where pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); let mut val = 0; for i in 0..(bit_width as usize) { if self.get_bit(i + bit_offset) { @@ -75,7 +78,10 @@ where pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { debug_assert!(bit_width <= 64); debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + debug_assert!( + (bit_offset + (bit_width as usize)) / 8 <= + self.storage.as_ref().len() + ); for i in 0..(bit_width as usize) { let mask = 1 << i; let val_bit_is_set = val & mask == mask; @@ -89,16 +95,16 @@ where } } #[repr(C, packed(4))] -#[repr(align(4))] #[derive(Debug, Default, Copy, Clone)] pub struct Test { + pub foo: u64, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u64>, } #[test] fn bindgen_test_layout_Test() { assert_eq!( ::std::mem::size_of::(), - 8usize, + 16usize, concat!("Size of: ", stringify!(Test)) ); assert_eq!( @@ -106,11 +112,18 @@ fn bindgen_test_layout_Test() { 4usize, concat!("Alignment of ", stringify!(Test)) ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).foo as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo)) + ); } impl Test { #[inline] pub fn x(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 56u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(0usize, 56u8) as u64) + } } #[inline] pub fn set_x(&mut self, val: u64) { @@ -121,7 +134,9 @@ impl Test { } #[inline] pub fn y(&self) -> u64 { - unsafe { ::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u64) } + unsafe { + ::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u64) + } } #[inline] pub fn set_y(&mut self, val: u64) { @@ -131,9 +146,14 @@ impl Test { } } #[inline] - pub fn new_bitfield_1(x: u64, y: u64) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize], u64> = - Default::default(); + pub fn new_bitfield_1( + x: u64, + y: u64, + ) -> __BindgenBitfieldUnit<[u8; 8usize], u64> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit< + [u8; 8usize], + u64, + > = Default::default(); __bindgen_bitfield_unit.set(0usize, 56u8, { let x: u64 = unsafe { ::std::mem::transmute(x) }; x as u64 diff --git a/tests/headers/bitfield-linux-32.hpp b/tests/headers/bitfield-linux-32.hpp index b15aaded4d..b9a480df15 100644 --- a/tests/headers/bitfield-linux-32.hpp +++ b/tests/headers/bitfield-linux-32.hpp @@ -3,6 +3,7 @@ typedef unsigned long long uint64_t; struct Test { + uint64_t foo; uint64_t x : 56; uint64_t y : 8; };