Skip to content

Commit 73f33e5

Browse files
authored
Fix clippy warnings (#2362)
1 parent 6e5a666 commit 73f33e5

File tree

3 files changed

+35
-36
lines changed

3 files changed

+35
-36
lines changed

bindgen/codegen/mod.rs

+32-32
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ trait CodeGenerator {
434434
/// Extra information returned to the caller.
435435
type Return;
436436

437-
fn codegen<'a>(
437+
fn codegen(
438438
&self,
439439
ctx: &BindgenContext,
440-
result: &mut CodegenResult<'a>,
440+
result: &mut CodegenResult<'_>,
441441
extra: &Self::Extra,
442442
) -> Self::Return;
443443
}
@@ -477,10 +477,10 @@ impl CodeGenerator for Item {
477477
type Extra = ();
478478
type Return = ();
479479

480-
fn codegen<'a>(
480+
fn codegen(
481481
&self,
482482
ctx: &BindgenContext,
483-
result: &mut CodegenResult<'a>,
483+
result: &mut CodegenResult<'_>,
484484
_extra: &(),
485485
) {
486486
debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
@@ -509,10 +509,10 @@ impl CodeGenerator for Module {
509509
type Extra = Item;
510510
type Return = ();
511511

512-
fn codegen<'a>(
512+
fn codegen(
513513
&self,
514514
ctx: &BindgenContext,
515-
result: &mut CodegenResult<'a>,
515+
result: &mut CodegenResult<'_>,
516516
item: &Item,
517517
) {
518518
debug!("<Module as CodeGenerator>::codegen: item = {:?}", item);
@@ -601,10 +601,10 @@ impl CodeGenerator for Var {
601601
type Extra = Item;
602602
type Return = ();
603603

604-
fn codegen<'a>(
604+
fn codegen(
605605
&self,
606606
ctx: &BindgenContext,
607-
result: &mut CodegenResult<'a>,
607+
result: &mut CodegenResult<'_>,
608608
item: &Item,
609609
) {
610610
use crate::ir::var::VarType;
@@ -748,10 +748,10 @@ impl CodeGenerator for Type {
748748
type Extra = Item;
749749
type Return = ();
750750

751-
fn codegen<'a>(
751+
fn codegen(
752752
&self,
753753
ctx: &BindgenContext,
754-
result: &mut CodegenResult<'a>,
754+
result: &mut CodegenResult<'_>,
755755
item: &Item,
756756
) {
757757
debug!("<Type as CodeGenerator>::codegen: item = {:?}", item);
@@ -1069,10 +1069,10 @@ impl<'a> CodeGenerator for Vtable<'a> {
10691069
type Extra = Item;
10701070
type Return = ();
10711071

1072-
fn codegen<'b>(
1072+
fn codegen(
10731073
&self,
10741074
ctx: &BindgenContext,
1075-
result: &mut CodegenResult<'b>,
1075+
result: &mut CodegenResult<'_>,
10761076
item: &Item,
10771077
) {
10781078
assert_eq!(item.id(), self.item_id);
@@ -1168,10 +1168,10 @@ impl CodeGenerator for TemplateInstantiation {
11681168
type Extra = Item;
11691169
type Return = ();
11701170

1171-
fn codegen<'a>(
1171+
fn codegen(
11721172
&self,
11731173
ctx: &BindgenContext,
1174-
result: &mut CodegenResult<'a>,
1174+
result: &mut CodegenResult<'_>,
11751175
item: &Item,
11761176
) {
11771177
debug_assert!(item.is_enabled_for_codegen(ctx));
@@ -1796,10 +1796,10 @@ impl CodeGenerator for CompInfo {
17961796
type Extra = Item;
17971797
type Return = ();
17981798

1799-
fn codegen<'a>(
1799+
fn codegen(
18001800
&self,
18011801
ctx: &BindgenContext,
1802-
result: &mut CodegenResult<'a>,
1802+
result: &mut CodegenResult<'_>,
18031803
item: &Item,
18041804
) {
18051805
debug!("<CompInfo as CodeGenerator>::codegen: item = {:?}", item);
@@ -2407,23 +2407,23 @@ impl CodeGenerator for CompInfo {
24072407
}
24082408

24092409
trait MethodCodegen {
2410-
fn codegen_method<'a>(
2410+
fn codegen_method(
24112411
&self,
24122412
ctx: &BindgenContext,
24132413
methods: &mut Vec<proc_macro2::TokenStream>,
24142414
method_names: &mut HashSet<String>,
2415-
result: &mut CodegenResult<'a>,
2415+
result: &mut CodegenResult<'_>,
24162416
parent: &CompInfo,
24172417
);
24182418
}
24192419

24202420
impl MethodCodegen for Method {
2421-
fn codegen_method<'a>(
2421+
fn codegen_method(
24222422
&self,
24232423
ctx: &BindgenContext,
24242424
methods: &mut Vec<proc_macro2::TokenStream>,
24252425
method_names: &mut HashSet<String>,
2426-
result: &mut CodegenResult<'a>,
2426+
result: &mut CodegenResult<'_>,
24272427
_parent: &CompInfo,
24282428
) {
24292429
assert!({
@@ -2779,13 +2779,13 @@ impl<'a> EnumBuilder<'a> {
27792779
}
27802780

27812781
/// Add a variant to this enum.
2782-
fn with_variant<'b>(
2782+
fn with_variant(
27832783
self,
27842784
ctx: &BindgenContext,
27852785
variant: &EnumVariant,
27862786
mangling_prefix: Option<&str>,
27872787
rust_ty: proc_macro2::TokenStream,
2788-
result: &mut CodegenResult<'b>,
2788+
result: &mut CodegenResult<'_>,
27892789
is_ty_named: bool,
27902790
) -> Self {
27912791
let variant_name = ctx.rust_mangle(variant.name());
@@ -2896,11 +2896,11 @@ impl<'a> EnumBuilder<'a> {
28962896
}
28972897
}
28982898

2899-
fn build<'b>(
2899+
fn build(
29002900
self,
29012901
ctx: &BindgenContext,
29022902
rust_ty: proc_macro2::TokenStream,
2903-
result: &mut CodegenResult<'b>,
2903+
result: &mut CodegenResult<'_>,
29042904
) -> proc_macro2::TokenStream {
29052905
match self {
29062906
EnumBuilder::Rust {
@@ -2999,10 +2999,10 @@ impl CodeGenerator for Enum {
29992999
type Extra = Item;
30003000
type Return = ();
30013001

3002-
fn codegen<'a>(
3002+
fn codegen(
30033003
&self,
30043004
ctx: &BindgenContext,
3005-
result: &mut CodegenResult<'a>,
3005+
result: &mut CodegenResult<'_>,
30063006
item: &Item,
30073007
) {
30083008
debug!("<Enum as CodeGenerator>::codegen: item = {:?}", item);
@@ -3137,7 +3137,7 @@ impl CodeGenerator for Enum {
31373137
attrs.push(attributes::derives(&derives));
31383138
}
31393139

3140-
fn add_constant<'a>(
3140+
fn add_constant(
31413141
ctx: &BindgenContext,
31423142
enum_: &Type,
31433143
// Only to avoid recomputing every time.
@@ -3148,7 +3148,7 @@ impl CodeGenerator for Enum {
31483148
variant_name: &Ident,
31493149
referenced_name: &Ident,
31503150
enum_rust_ty: proc_macro2::TokenStream,
3151-
result: &mut CodegenResult<'a>,
3151+
result: &mut CodegenResult<'_>,
31523152
) {
31533153
let constant_name = if enum_.name().is_some() {
31543154
if ctx.options().prepend_enum_name {
@@ -3995,10 +3995,10 @@ impl CodeGenerator for Function {
39953995
/// it.
39963996
type Return = Option<u32>;
39973997

3998-
fn codegen<'a>(
3998+
fn codegen(
39993999
&self,
40004000
ctx: &BindgenContext,
4001-
result: &mut CodegenResult<'a>,
4001+
result: &mut CodegenResult<'_>,
40024002
item: &Item,
40034003
) -> Self::Return {
40044004
debug!("<Function as CodeGenerator>::codegen: item = {:?}", item);
@@ -4237,10 +4237,10 @@ impl CodeGenerator for ObjCInterface {
42374237
type Extra = Item;
42384238
type Return = ();
42394239

4240-
fn codegen<'a>(
4240+
fn codegen(
42414241
&self,
42424242
ctx: &BindgenContext,
4243-
result: &mut CodegenResult<'a>,
4243+
result: &mut CodegenResult<'_>,
42444244
item: &Item,
42454245
) {
42464246
debug_assert!(item.is_enabled_for_codegen(ctx));

bindgen/ir/analysis/template_params.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
424424
// generic template parameters are used.
425425
let item_kind =
426426
ctx.resolve_item(item).as_type().map(|ty| ty.kind());
427-
if let Some(&TypeKind::TemplateInstantiation(ref inst)) = item_kind
428-
{
427+
if let Some(TypeKind::TemplateInstantiation(inst)) = item_kind {
429428
let decl = ctx.resolve_type(inst.template_definition());
430429
let args = inst.template_arguments();
431430

@@ -540,7 +539,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
540539
}
541540
// Template instantiations only use their template arguments if the
542541
// template definition uses the corresponding template parameter.
543-
Some(&TypeKind::TemplateInstantiation(ref inst)) => {
542+
Some(TypeKind::TemplateInstantiation(inst)) => {
544543
if self
545544
.allowlisted_items
546545
.contains(&inst.template_definition().into())

bindgen/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ impl Builder {
16051605

16061606
// For each input header content, add a prefix line of `#line 0 "$name"`
16071607
// followed by the contents.
1608-
for &(ref name, ref contents) in &self.options.input_header_contents {
1608+
for (name, contents) in &self.options.input_header_contents {
16091609
is_cpp |= file_is_cpp(name);
16101610

16111611
wrapper_contents.push_str("#line 0 \"");

0 commit comments

Comments
 (0)