summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poveda Ruiz <31802960+pvdrz@users.noreply.github.com>2022-11-24 10:50:15 -0500
committerGitHub <noreply@github.com>2022-11-24 10:50:15 -0500
commit73f33e5a0288f4030e1e4389db0d9bfca1d69d2d (patch)
treeb45e94509f5b617d322cd699cb2933ace24f8b99
parent6e5a666507bb5f4611dc31ca2e11e73cb5ffdbd1 (diff)
Fix clippy warnings (#2362)
-rw-r--r--bindgen/codegen/mod.rs64
-rw-r--r--bindgen/ir/analysis/template_params.rs5
-rw-r--r--bindgen/lib.rs2
3 files changed, 35 insertions, 36 deletions
diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs
index e5372427..e201578e 100644
--- a/bindgen/codegen/mod.rs
+++ b/bindgen/codegen/mod.rs
@@ -434,10 +434,10 @@ trait CodeGenerator {
/// Extra information returned to the caller.
type Return;
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
extra: &Self::Extra,
) -> Self::Return;
}
@@ -477,10 +477,10 @@ impl CodeGenerator for Item {
type Extra = ();
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
_extra: &(),
) {
debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
@@ -509,10 +509,10 @@ impl CodeGenerator for Module {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug!("<Module as CodeGenerator>::codegen: item = {:?}", item);
@@ -601,10 +601,10 @@ impl CodeGenerator for Var {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
use crate::ir::var::VarType;
@@ -748,10 +748,10 @@ impl CodeGenerator for Type {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug!("<Type as CodeGenerator>::codegen: item = {:?}", item);
@@ -1069,10 +1069,10 @@ impl<'a> CodeGenerator for Vtable<'a> {
type Extra = Item;
type Return = ();
- fn codegen<'b>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'b>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
assert_eq!(item.id(), self.item_id);
@@ -1168,10 +1168,10 @@ impl CodeGenerator for TemplateInstantiation {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug_assert!(item.is_enabled_for_codegen(ctx));
@@ -1796,10 +1796,10 @@ impl CodeGenerator for CompInfo {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug!("<CompInfo as CodeGenerator>::codegen: item = {:?}", item);
@@ -2407,23 +2407,23 @@ impl CodeGenerator for CompInfo {
}
trait MethodCodegen {
- fn codegen_method<'a>(
+ fn codegen_method(
&self,
ctx: &BindgenContext,
methods: &mut Vec<proc_macro2::TokenStream>,
method_names: &mut HashSet<String>,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
parent: &CompInfo,
);
}
impl MethodCodegen for Method {
- fn codegen_method<'a>(
+ fn codegen_method(
&self,
ctx: &BindgenContext,
methods: &mut Vec<proc_macro2::TokenStream>,
method_names: &mut HashSet<String>,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
_parent: &CompInfo,
) {
assert!({
@@ -2779,13 +2779,13 @@ impl<'a> EnumBuilder<'a> {
}
/// Add a variant to this enum.
- fn with_variant<'b>(
+ fn with_variant(
self,
ctx: &BindgenContext,
variant: &EnumVariant,
mangling_prefix: Option<&str>,
rust_ty: proc_macro2::TokenStream,
- result: &mut CodegenResult<'b>,
+ result: &mut CodegenResult<'_>,
is_ty_named: bool,
) -> Self {
let variant_name = ctx.rust_mangle(variant.name());
@@ -2896,11 +2896,11 @@ impl<'a> EnumBuilder<'a> {
}
}
- fn build<'b>(
+ fn build(
self,
ctx: &BindgenContext,
rust_ty: proc_macro2::TokenStream,
- result: &mut CodegenResult<'b>,
+ result: &mut CodegenResult<'_>,
) -> proc_macro2::TokenStream {
match self {
EnumBuilder::Rust {
@@ -2999,10 +2999,10 @@ impl CodeGenerator for Enum {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug!("<Enum as CodeGenerator>::codegen: item = {:?}", item);
@@ -3137,7 +3137,7 @@ impl CodeGenerator for Enum {
attrs.push(attributes::derives(&derives));
}
- fn add_constant<'a>(
+ fn add_constant(
ctx: &BindgenContext,
enum_: &Type,
// Only to avoid recomputing every time.
@@ -3148,7 +3148,7 @@ impl CodeGenerator for Enum {
variant_name: &Ident,
referenced_name: &Ident,
enum_rust_ty: proc_macro2::TokenStream,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
) {
let constant_name = if enum_.name().is_some() {
if ctx.options().prepend_enum_name {
@@ -3995,10 +3995,10 @@ impl CodeGenerator for Function {
/// it.
type Return = Option<u32>;
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) -> Self::Return {
debug!("<Function as CodeGenerator>::codegen: item = {:?}", item);
@@ -4237,10 +4237,10 @@ impl CodeGenerator for ObjCInterface {
type Extra = Item;
type Return = ();
- fn codegen<'a>(
+ fn codegen(
&self,
ctx: &BindgenContext,
- result: &mut CodegenResult<'a>,
+ result: &mut CodegenResult<'_>,
item: &Item,
) {
debug_assert!(item.is_enabled_for_codegen(ctx));
diff --git a/bindgen/ir/analysis/template_params.rs b/bindgen/ir/analysis/template_params.rs
index e88b774d..f4f0c59d 100644
--- a/bindgen/ir/analysis/template_params.rs
+++ b/bindgen/ir/analysis/template_params.rs
@@ -424,8 +424,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
// generic template parameters are used.
let item_kind =
ctx.resolve_item(item).as_type().map(|ty| ty.kind());
- if let Some(&TypeKind::TemplateInstantiation(ref inst)) = item_kind
- {
+ if let Some(TypeKind::TemplateInstantiation(inst)) = item_kind {
let decl = ctx.resolve_type(inst.template_definition());
let args = inst.template_arguments();
@@ -540,7 +539,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
}
// Template instantiations only use their template arguments if the
// template definition uses the corresponding template parameter.
- Some(&TypeKind::TemplateInstantiation(ref inst)) => {
+ Some(TypeKind::TemplateInstantiation(inst)) => {
if self
.allowlisted_items
.contains(&inst.template_definition().into())
diff --git a/bindgen/lib.rs b/bindgen/lib.rs
index 4b71fb97..4402dfc7 100644
--- a/bindgen/lib.rs
+++ b/bindgen/lib.rs
@@ -1605,7 +1605,7 @@ impl Builder {
// For each input header content, add a prefix line of `#line 0 "$name"`
// followed by the contents.
- for &(ref name, ref contents) in &self.options.input_header_contents {
+ for (name, contents) in &self.options.input_header_contents {
is_cpp |= file_is_cpp(name);
wrapper_contents.push_str("#line 0 \"");