diff options
author | Christian Poveda <christian.poveda@ferrous-systems.com> | 2022-09-01 11:45:08 -0500 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-09-01 18:57:50 +0200 |
commit | 2aa244f8fcb8bdd2297cf1d5eebbc19c0a6fb5f3 (patch) | |
tree | be7b50f1c7c3b58273dfe3f076780774ecb082ca /src | |
parent | a5848cf44e02645cddf020609ea67340cf6e3d24 (diff) |
address clippy lints
Diffstat (limited to 'src')
-rw-r--r-- | src/clang.rs | 10 | ||||
-rw-r--r-- | src/codegen/mod.rs | 9 | ||||
-rw-r--r-- | src/ir/analysis/derive.rs | 10 | ||||
-rw-r--r-- | src/ir/annotations.rs | 2 | ||||
-rw-r--r-- | src/ir/comp.rs | 14 | ||||
-rw-r--r-- | src/ir/context.rs | 1 | ||||
-rw-r--r-- | src/ir/layout.rs | 2 | ||||
-rw-r--r-- | src/ir/ty.rs | 2 |
8 files changed, 25 insertions, 25 deletions
diff --git a/src/clang.rs b/src/clang.rs index 00716a1b..2aab9618 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -278,12 +278,12 @@ impl Cursor { /// Is the referent any kind of template parameter? pub fn is_template_parameter(&self) -> bool { - match self.kind() { + matches!( + self.kind(), CXCursor_TemplateTemplateParameter | - CXCursor_TemplateTypeParameter | - CXCursor_NonTypeTemplateParameter => true, - _ => false, - } + CXCursor_TemplateTypeParameter | + CXCursor_NonTypeTemplateParameter + ) } /// Does the referent's type or value depend on a template parameter? diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 77e9ba95..ca4cbf23 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1212,6 +1212,7 @@ impl CodeGenerator for TemplateInstantiation { trait FieldCodegen<'a> { type Extra; + #[allow(clippy::too_many_arguments)] fn codegen<F, M>( &self, ctx: &BindgenContext, @@ -2563,7 +2564,7 @@ impl MethodCodegen for Method { } /// A helper type that represents different enum variations. -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum EnumVariation { /// The code for this enum will use a Rust enum. Note that creating this in unsafe code /// (including FFI) with an invalid value will invoke undefined behaviour, whether or not @@ -3213,7 +3214,7 @@ impl CodeGenerator for Enum { ctx, enum_ty, &ident, - &Ident::new(&*mangled_name, Span::call_site()), + &Ident::new(&mangled_name, Span::call_site()), existing_variant_name, enum_rust_ty.clone(), result, @@ -3282,7 +3283,7 @@ impl CodeGenerator for Enum { } /// Enum for the default type of macro constants. -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum MacroTypeVariation { /// Use i32 or i64 Signed, @@ -3326,7 +3327,7 @@ impl std::str::FromStr for MacroTypeVariation { } /// Enum for how aliases should be translated. -#[derive(Copy, Clone, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum AliasVariation { /// Convert to regular Rust alias TypeAlias, diff --git a/src/ir/analysis/derive.rs b/src/ir/analysis/derive.rs index f63458e5..d888cd55 100644 --- a/src/ir/analysis/derive.rs +++ b/src/ir/analysis/derive.rs @@ -485,11 +485,11 @@ impl DeriveTrait { fn consider_edge_tmpl_inst(&self) -> EdgePredicate { match self { DeriveTrait::PartialEqOrPartialOrd => consider_edge_default, - _ => |kind| match kind { - EdgeKind::TemplateArgument | EdgeKind::TemplateDeclaration => { - true - } - _ => false, + _ => |kind| { + matches!( + kind, + EdgeKind::TemplateArgument | EdgeKind::TemplateDeclaration + ) }, } } diff --git a/src/ir/annotations.rs b/src/ir/annotations.rs index 9bcda508..4847333a 100644 --- a/src/ir/annotations.rs +++ b/src/ir/annotations.rs @@ -7,7 +7,7 @@ use crate::clang; /// What kind of accessor should we provide for a field? -#[derive(Copy, PartialEq, Clone, Debug)] +#[derive(Copy, PartialEq, Eq, Clone, Debug)] pub enum FieldAccessorKind { /// No accessor. None, diff --git a/src/ir/comp.rs b/src/ir/comp.rs index 9808d598..fdf6a963 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -20,7 +20,7 @@ use std::io; use std::mem; /// The kind of compound type. -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum CompKind { /// A struct. Struct, @@ -29,7 +29,7 @@ pub enum CompKind { } /// The kind of C++ method. -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum MethodKind { /// A constructor. We represent it as method for convenience, to avoid code /// duplication. @@ -55,12 +55,10 @@ pub enum MethodKind { impl MethodKind { /// Is this a destructor method? pub fn is_destructor(&self) -> bool { - match *self { - MethodKind::Destructor | MethodKind::VirtualDestructor { .. } => { - true - } - _ => false, - } + matches!( + *self, + MethodKind::Destructor | MethodKind::VirtualDestructor { .. } + ) } /// Is this a pure virtual method? diff --git a/src/ir/context.rs b/src/ir/context.rs index aa03b209..51076482 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -467,6 +467,7 @@ pub struct BindgenContext { /// A traversal of allowlisted items. struct AllowlistedItemsTraversal<'ctx> { ctx: &'ctx BindgenContext, + #[allow(clippy::type_complexity)] traversal: ItemTraversal< 'ctx, ItemSet, diff --git a/src/ir/layout.rs b/src/ir/layout.rs index 6cf91131..472eae3d 100644 --- a/src/ir/layout.rs +++ b/src/ir/layout.rs @@ -7,7 +7,7 @@ use crate::ir::context::BindgenContext; use std::cmp; /// A type that represents the struct layout of a type. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Layout { /// The size (in bytes) of this layout. pub size: usize, diff --git a/src/ir/ty.rs b/src/ir/ty.rs index 38ab4564..c85bc687 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -564,7 +564,7 @@ impl TemplateParameters for TypeKind { } /// The kind of float this type represents. -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum FloatKind { /// A `float`. Float, |