diff options
author | Christian Poveda <christian.poveda@ferrous-systems.com> | 2022-10-03 13:02:03 -0500 |
---|---|---|
committer | Christian Poveda <christian.poveda@ferrous-systems.com> | 2022-10-03 13:02:17 -0500 |
commit | cebdedcc40f55d85d1370455c9d596a7c4ac1a19 (patch) | |
tree | 04254cf657b17ab8de1883bfcfde821bc6ebbe8c /src | |
parent | 15aef5e43b9ad756887e4329b87908da638bcc60 (diff) |
address clippy lints
Diffstat (limited to 'src')
-rw-r--r-- | src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | src/ir/enum_ty.rs | 2 | ||||
-rw-r--r-- | src/ir/var.rs | 10 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/options.rs | 8 |
5 files changed, 10 insertions, 14 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index a8a7b076..7e0d7aa0 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -3439,7 +3439,7 @@ impl std::str::FromStr for AliasVariation { } /// Enum for how non-Copy unions should be translated. -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum NonCopyUnionStyle { /// Wrap members in a type generated by bindgen. BindgenWrapper, diff --git a/src/ir/enum_ty.rs b/src/ir/enum_ty.rs index 2b039a4f..123d1d79 100644 --- a/src/ir/enum_ty.rs +++ b/src/ir/enum_ty.rs @@ -165,7 +165,7 @@ impl Enum { return false; } - self.variants().iter().any(|v| enums.matches(&v.name())) + self.variants().iter().any(|v| enums.matches(v.name())) } /// Returns the final representation of the enum. diff --git a/src/ir/var.rs b/src/ir/var.rs index e44d57af..eecca4df 100644 --- a/src/ir/var.rs +++ b/src/ir/var.rs @@ -325,8 +325,7 @@ impl ClangSubItemParser for Var { let mut val = cursor.evaluate().and_then(|v| v.as_int()); if val.is_none() || !kind.signedness_matches(val.unwrap()) { - let tu = ctx.translation_unit(); - val = get_integer_literal_from_cursor(&cursor, tu); + val = get_integer_literal_from_cursor(&cursor); } val.map(|val| { @@ -391,10 +390,7 @@ fn parse_int_literal_tokens(cursor: &clang::Cursor) -> Option<i64> { } } -fn get_integer_literal_from_cursor( - cursor: &clang::Cursor, - unit: &clang::TranslationUnit, -) -> Option<i64> { +fn get_integer_literal_from_cursor(cursor: &clang::Cursor) -> Option<i64> { use clang_sys::*; let mut value = None; cursor.visit(|c| { @@ -403,7 +399,7 @@ fn get_integer_literal_from_cursor( value = parse_int_literal_tokens(&c); } CXCursor_UnexposedExpr => { - value = get_integer_literal_from_cursor(&c, unit); + value = get_integer_literal_from_cursor(&c); } _ => (), } @@ -2647,7 +2647,7 @@ impl Bindings { .as_ref() .and_then(|f| f.to_str()) { - cmd.args(&["--config-path", path]); + cmd.args(["--config-path", path]); } let mut child = cmd.spawn()?; diff --git a/src/options.rs b/src/options.rs index 29edb78b..1025a36d 100644 --- a/src/options.rs +++ b/src/options.rs @@ -39,7 +39,7 @@ where .help("The default style of code used to generate enums.") .value_name("variant") .default_value("consts") - .possible_values(&[ + .possible_values([ "consts", "moduleconsts", "bitfield", @@ -98,14 +98,14 @@ where .help("The default signed/unsigned type for C macro constants.") .value_name("variant") .default_value("unsigned") - .possible_values(&["signed", "unsigned"]) + .possible_values(["signed", "unsigned"]) .multiple_occurrences(false), Arg::new("default-alias-style") .long("default-alias-style") .help("The default style of code used to generate typedefs.") .value_name("variant") .default_value("type_alias") - .possible_values(&[ + .possible_values([ "type_alias", "new_type", "new_type_deref", @@ -147,7 +147,7 @@ where ) .value_name("style") .default_value("bindgen_wrapper") - .possible_values(&[ + .possible_values([ "bindgen_wrapper", "manually_drop", ]) |