Skip to content

Commit 7ca75a6

Browse files
nyurikemilio
authored andcommitted
a few more lints
1 parent d5a2c81 commit 7ca75a6

File tree

15 files changed

+29
-34
lines changed

15 files changed

+29
-34
lines changed

bindgen-tests/tests/quickchecking/src/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
//! use quickcheck::{Arbitrary, Gen};
77
//! use quickchecking::fuzzers;
88
//!
9-
//! fn main() {
10-
//! let generate_range: usize = 10; // Determines things like the length of
11-
//! // arbitrary vectors generated.
12-
//! let header = fuzzers::HeaderC::arbitrary(
13-
//! &mut Gen::new(generate_range));
14-
//! println!("{}", header);
15-
//! }
9+
//! let generate_range: usize = 10; // Determines things like the length of
10+
//! // arbitrary vectors generated.
11+
//! let header = fuzzers::HeaderC::arbitrary(&mut Gen::new(generate_range));
12+
//! println!("{}", header);
1613
//! ```
1714
#![deny(missing_docs)]
1815

bindgen/clang.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ impl<'a> RawTokens<'a> {
10161016
}
10171017
}
10181018

1019-
impl<'a> Drop for RawTokens<'a> {
1019+
impl Drop for RawTokens<'_> {
10201020
fn drop(&mut self) {
10211021
if !self.tokens.is_null() {
10221022
unsafe {
@@ -1090,7 +1090,7 @@ pub(crate) struct ClangTokenIterator<'a> {
10901090
raw: slice::Iter<'a, CXToken>,
10911091
}
10921092

1093-
impl<'a> Iterator for ClangTokenIterator<'a> {
1093+
impl Iterator for ClangTokenIterator<'_> {
10941094
type Item = ClangToken;
10951095

10961096
fn next(&mut self) -> Option<Self::Item> {

bindgen/codegen/impl_debug.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub(crate) trait ImplDebug<'a> {
6464
) -> Option<(String, Vec<proc_macro2::TokenStream>)>;
6565
}
6666

67-
impl<'a> ImplDebug<'a> for FieldData {
67+
impl ImplDebug<'_> for FieldData {
6868
type Extra = ();
6969

7070
fn impl_debug(
@@ -80,7 +80,7 @@ impl<'a> ImplDebug<'a> for FieldData {
8080
}
8181
}
8282

83-
impl<'a> ImplDebug<'a> for BitfieldUnit {
83+
impl ImplDebug<'_> for BitfieldUnit {
8484
type Extra = ();
8585

8686
fn impl_debug(

bindgen/codegen/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,15 @@ impl<'a> CodegenResult<'a> {
372372
}
373373
}
374374

375-
impl<'a> ops::Deref for CodegenResult<'a> {
375+
impl ops::Deref for CodegenResult<'_> {
376376
type Target = Vec<proc_macro2::TokenStream>;
377377

378378
fn deref(&self) -> &Self::Target {
379379
&self.items
380380
}
381381
}
382382

383-
impl<'a> ops::DerefMut for CodegenResult<'a> {
383+
impl ops::DerefMut for CodegenResult<'_> {
384384
fn deref_mut(&mut self) -> &mut Self::Target {
385385
&mut self.items
386386
}
@@ -727,7 +727,7 @@ impl CodeGenerator for Var {
727727
if let Some(cstr) = cstr {
728728
let cstr_ty = quote! { ::#prefix::ffi::CStr };
729729
if rust_features.literal_cstr {
730-
let cstr = proc_macro2::Literal::c_string(&cstr);
730+
let cstr = proc_macro2::Literal::c_string(cstr);
731731
result.push(quote! {
732732
#(#attrs)*
733733
pub const #canonical_ident: &#cstr_ty = #cstr;
@@ -1165,7 +1165,7 @@ impl<'a> Vtable<'a> {
11651165
}
11661166
}
11671167

1168-
impl<'a> CodeGenerator for Vtable<'a> {
1168+
impl CodeGenerator for Vtable<'_> {
11691169
type Extra = Item;
11701170
type Return = ();
11711171

@@ -1243,13 +1243,13 @@ impl<'a> CodeGenerator for Vtable<'a> {
12431243
}
12441244
}
12451245

1246-
impl<'a> ItemCanonicalName for Vtable<'a> {
1246+
impl ItemCanonicalName for Vtable<'_> {
12471247
fn canonical_name(&self, ctx: &BindgenContext) -> String {
12481248
format!("{}__bindgen_vtable", self.item_id.canonical_name(ctx))
12491249
}
12501250
}
12511251

1252-
impl<'a> TryToRustTy for Vtable<'a> {
1252+
impl TryToRustTy for Vtable<'_> {
12531253
type Extra = ();
12541254

12551255
fn try_to_rust_ty(
@@ -1375,7 +1375,7 @@ trait FieldCodegen<'a> {
13751375
M: Extend<proc_macro2::TokenStream>;
13761376
}
13771377

1378-
impl<'a> FieldCodegen<'a> for Field {
1378+
impl FieldCodegen<'_> for Field {
13791379
type Extra = ();
13801380

13811381
fn codegen<F, M>(
@@ -1453,7 +1453,7 @@ fn wrap_union_field_if_needed(
14531453
}
14541454
}
14551455

1456-
impl<'a> FieldCodegen<'a> for FieldData {
1456+
impl FieldCodegen<'_> for FieldData {
14571457
type Extra = ();
14581458

14591459
fn codegen<F, M>(
@@ -1713,7 +1713,7 @@ fn compute_visibility(
17131713
})
17141714
}
17151715

1716-
impl<'a> FieldCodegen<'a> for BitfieldUnit {
1716+
impl FieldCodegen<'_> for BitfieldUnit {
17171717
type Extra = ();
17181718

17191719
fn codegen<F, M>(

bindgen/codegen/serialize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'a> CSerialize<'a> for Function {
198198
}
199199
}
200200

201-
impl<'a> CSerialize<'a> for TypeId {
201+
impl CSerialize<'_> for TypeId {
202202
type Extra = ();
203203

204204
fn serialize<W: Write>(

bindgen/ir/analysis/derive.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn consider_edge_default(kind: EdgeKind) -> bool {
104104
}
105105
}
106106

107-
impl<'ctx> CannotDerive<'ctx> {
107+
impl CannotDerive<'_> {
108108
fn insert<Id: Into<ItemId>>(
109109
&mut self,
110110
id: Id,
@@ -217,9 +217,7 @@ impl<'ctx> CannotDerive<'ctx> {
217217
TypeKind::Reference(..) |
218218
TypeKind::ObjCInterface(..) |
219219
TypeKind::ObjCId |
220-
TypeKind::ObjCSel => {
221-
return self.derive_trait.can_derive_simple(ty.kind());
222-
}
220+
TypeKind::ObjCSel => self.derive_trait.can_derive_simple(ty.kind()),
223221
TypeKind::Pointer(inner) => {
224222
let inner_type =
225223
self.ctx.resolve_type(inner).canonical_type(self.ctx);

bindgen/ir/analysis/has_destructor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub(crate) struct HasDestructorAnalysis<'ctx> {
3939
dependencies: HashMap<ItemId, Vec<ItemId>>,
4040
}
4141

42-
impl<'ctx> HasDestructorAnalysis<'ctx> {
42+
impl HasDestructorAnalysis<'_> {
4343
fn consider_edge(kind: EdgeKind) -> bool {
4444
// These are the only edges that can affect whether a type has a
4545
// destructor or not.

bindgen/ir/analysis/has_float.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub(crate) struct HasFloat<'ctx> {
3939
dependencies: HashMap<ItemId, Vec<ItemId>>,
4040
}
4141

42-
impl<'ctx> HasFloat<'ctx> {
42+
impl HasFloat<'_> {
4343
fn consider_edge(kind: EdgeKind) -> bool {
4444
match kind {
4545
EdgeKind::BaseMember |

bindgen/ir/analysis/has_type_param_in_array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub(crate) struct HasTypeParameterInArray<'ctx> {
3939
dependencies: HashMap<ItemId, Vec<ItemId>>,
4040
}
4141

42-
impl<'ctx> HasTypeParameterInArray<'ctx> {
42+
impl HasTypeParameterInArray<'_> {
4343
fn consider_edge(kind: EdgeKind) -> bool {
4444
match kind {
4545
// These are the only edges that can affect whether a type has type parameter

bindgen/ir/analysis/has_vtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub(crate) struct HasVtableAnalysis<'ctx> {
7272
dependencies: HashMap<ItemId, Vec<ItemId>>,
7373
}
7474

75-
impl<'ctx> HasVtableAnalysis<'ctx> {
75+
impl HasVtableAnalysis<'_> {
7676
fn consider_edge(kind: EdgeKind) -> bool {
7777
// These are the only edges that can affect whether a type has a
7878
// vtable or not.

bindgen/ir/analysis/sizedness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub(crate) struct SizednessAnalysis<'ctx> {
105105
sized: HashMap<TypeId, SizednessResult>,
106106
}
107107

108-
impl<'ctx> SizednessAnalysis<'ctx> {
108+
impl SizednessAnalysis<'_> {
109109
fn consider_edge(kind: EdgeKind) -> bool {
110110
// These are the only edges that can affect whether a type is
111111
// zero-sized or not.

bindgen/ir/analysis/template_params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub(crate) struct UsedTemplateParameters<'ctx> {
161161
allowlisted_items: HashSet<ItemId>,
162162
}
163163

164-
impl<'ctx> UsedTemplateParameters<'ctx> {
164+
impl UsedTemplateParameters<'_> {
165165
fn consider_edge(kind: EdgeKind) -> bool {
166166
match kind {
167167
// For each of these kinds of edges, if the referent uses a template

bindgen/ir/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ struct AllowlistedItemsTraversal<'ctx> {
501501
traversal: ItemTraversal<'ctx, ItemSet, Vec<ItemId>>,
502502
}
503503

504-
impl<'ctx> Iterator for AllowlistedItemsTraversal<'ctx> {
504+
impl Iterator for AllowlistedItemsTraversal<'_> {
505505
type Item = ItemId;
506506

507507
fn next(&mut self) -> Option<ItemId> {

bindgen/ir/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<'a> ItemAncestorsIter<'a> {
127127
}
128128
}
129129

130-
impl<'a> Iterator for ItemAncestorsIter<'a> {
130+
impl Iterator for ItemAncestorsIter<'_> {
131131
type Item = ItemId;
132132

133133
fn next(&mut self) -> Option<Self::Item> {

bindgen/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a> Timer<'a> {
4545
}
4646
}
4747

48-
impl<'a> Drop for Timer<'a> {
48+
impl Drop for Timer<'_> {
4949
fn drop(&mut self) {
5050
self.print_elapsed();
5151
}

0 commit comments

Comments
 (0)