Skip to content

Commit f020669

Browse files
committed
Linting semicolons
``` cargo clippy --workspace --fix --all-targets -- -A clippy::all -W clippy::semicolon_if_nothing_returned ```
1 parent c4440b3 commit f020669

24 files changed

+63
-63
lines changed

bindgen-cli/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn main() {
3535

3636
std::panic::set_hook(Box::new(move |info| {
3737
if verbose {
38-
print_verbose_err()
38+
print_verbose_err();
3939
}
4040
eprintln!("{info}");
4141
}));

bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/union_with_anon_struct_bitfield.rs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ fn main() {
105105
let generate_range = *matches.get_one::<usize>("range").unwrap();
106106
let tests = *matches.get_one::<u64>("count").unwrap();
107107

108-
quickchecking::test_bindgen(generate_range, tests, output_path)
108+
quickchecking::test_bindgen(generate_range, tests, output_path);
109109
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ pub fn test_bindgen(
103103
QuickCheck::new()
104104
.tests(tests)
105105
.gen(Gen::new(generate_range))
106-
.quickcheck(bindgen_prop as fn(fuzzers::HeaderC) -> TestResult)
106+
.quickcheck(bindgen_prop as fn(fuzzers::HeaderC) -> TestResult);
107107
}

bindgen/clang.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ impl Eq for Cursor {}
11441144

11451145
impl Hash for Cursor {
11461146
fn hash<H: Hasher>(&self, state: &mut H) {
1147-
unsafe { clang_hashCursor(self.x) }.hash(state)
1147+
unsafe { clang_hashCursor(self.x) }.hash(state);
11481148
}
11491149
}
11501150

bindgen/codegen/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ impl CodeGenerator for Type {
852852
// it to BindgenContext::compute_allowlisted_and_codegen_items.
853853
}
854854
TypeKind::TemplateInstantiation(ref inst) => {
855-
inst.codegen(ctx, result, item)
855+
inst.codegen(ctx, result, item);
856856
}
857857
TypeKind::BlockPointer(inner) => {
858858
if !ctx.options().generate_block {
@@ -1143,7 +1143,7 @@ impl CodeGenerator for Type {
11431143
result.saw_objc();
11441144
}
11451145
TypeKind::ObjCInterface(ref interface) => {
1146-
interface.codegen(ctx, result, item)
1146+
interface.codegen(ctx, result, item);
11471147
}
11481148
ref u @ TypeKind::UnresolvedTypeRef(..) => {
11491149
unreachable!("Should have been resolved after parsing {:?}!", u)
@@ -1230,7 +1230,7 @@ impl CodeGenerator for Vtable<'_> {
12301230
pub struct #name {
12311231
#( #methods ),*
12321232
}
1233-
})
1233+
});
12341234
} else {
12351235
// For the cases we don't support, simply generate an empty struct.
12361236
let void = helpers::ast_ty::c_void(ctx);
@@ -2323,7 +2323,7 @@ impl CodeGenerator for CompInfo {
23232323
let ty = helpers::blob(layout);
23242324
fields.push(quote! {
23252325
pub bindgen_union_field: #ty ,
2326-
})
2326+
});
23272327
}
23282328
}
23292329

@@ -2472,7 +2472,7 @@ impl CodeGenerator for CompInfo {
24722472
derives.extend(custom_derives.iter().map(|s| s.as_str()));
24732473

24742474
if !derives.is_empty() {
2475-
attributes.push(attributes::derives(&derives))
2475+
attributes.push(attributes::derives(&derives));
24762476
}
24772477

24782478
attributes.extend(
@@ -3099,7 +3099,7 @@ impl Method {
30993099
quote! {
31003100
__bindgen_tmp
31013101
}
3102-
})
3102+
});
31033103
}
31043104

31053105
let block = ctx.wrap_unsafe_ops(quote! ( #( #stmts );*));
@@ -4764,7 +4764,7 @@ fn unsupported_abi_diagnostic(
47644764
}
47654765
}
47664766

4767-
diag.display()
4767+
diag.display();
47684768
}
47694769
}
47704770

@@ -4802,7 +4802,7 @@ fn variadic_fn_diagnostic(
48024802
}
48034803
}
48044804

4805-
diag.display()
4805+
diag.display();
48064806
}
48074807
}
48084808

@@ -5234,10 +5234,10 @@ pub(crate) mod utils {
52345234
}
52355235
match ty.kind() {
52365236
TypeKind::Alias(type_id_alias) => {
5237-
type_id = *type_id_alias
5237+
type_id = *type_id_alias;
52385238
}
52395239
TypeKind::ResolvedTypeRef(type_id_typedef) => {
5240-
type_id = *type_id_typedef
5240+
type_id = *type_id_typedef;
52415241
}
52425242
_ => break,
52435243
}
@@ -5718,7 +5718,7 @@ pub(crate) mod utils {
57185718
.collect::<Vec<_>>();
57195719

57205720
if is_variadic {
5721-
args.push(quote! { ... })
5721+
args.push(quote! { ... });
57225722
}
57235723

57245724
args

bindgen/codegen/postprocessing/merge_extern_blocks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ use syn::{
44
};
55

66
pub(super) fn merge_extern_blocks(file: &mut File) {
7-
Visitor.visit_file_mut(file)
7+
Visitor.visit_file_mut(file);
88
}
99

1010
struct Visitor;
1111

1212
impl VisitMut for Visitor {
1313
fn visit_file_mut(&mut self, file: &mut File) {
1414
visit_items(&mut file.items);
15-
visit_file_mut(self, file)
15+
visit_file_mut(self, file);
1616
}
1717

1818
fn visit_item_mod_mut(&mut self, item_mod: &mut ItemMod) {
1919
if let Some((_, ref mut items)) = item_mod.content {
2020
visit_items(items);
2121
}
22-
visit_item_mod_mut(self, item_mod)
22+
visit_item_mod_mut(self, item_mod);
2323
}
2424
}
2525

bindgen/codegen/postprocessing/sort_semantically.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ use syn::{
44
};
55

66
pub(super) fn sort_semantically(file: &mut File) {
7-
Visitor.visit_file_mut(file)
7+
Visitor.visit_file_mut(file);
88
}
99

1010
struct Visitor;
1111

1212
impl VisitMut for Visitor {
1313
fn visit_file_mut(&mut self, file: &mut File) {
1414
visit_items(&mut file.items);
15-
visit_file_mut(self, file)
15+
visit_file_mut(self, file);
1616
}
1717

1818
fn visit_item_mod_mut(&mut self, item_mod: &mut ItemMod) {
1919
if let Some((_, ref mut items)) = item_mod.content {
2020
visit_items(items);
2121
}
22-
visit_item_mod_mut(self, item_mod)
22+
visit_item_mod_mut(self, item_mod);
2323
}
2424
}
2525

bindgen/codegen/serialize.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ impl<'a> CSerialize<'a> for Type {
228228
if self.is_const() {
229229
write!(writer, "const ")?;
230230
}
231-
write!(writer, "void")?
231+
write!(writer, "void")?;
232232
}
233233
TypeKind::NullPtr => {
234234
if self.is_const() {
235235
write!(writer, "const ")?;
236236
}
237-
write!(writer, "nullptr_t")?
237+
write!(writer, "nullptr_t")?;
238238
}
239239
TypeKind::Int(int_kind) => {
240240
if self.is_const() {
@@ -285,7 +285,7 @@ impl<'a> CSerialize<'a> for Type {
285285
FloatKind::Float => write!(writer, "float complex")?,
286286
FloatKind::Double => write!(writer, "double complex")?,
287287
FloatKind::LongDouble => {
288-
write!(writer, "long double complex")?
288+
write!(writer, "long double complex")?;
289289
}
290290
FloatKind::Float128 => write!(writer, "__complex128")?,
291291
}
@@ -303,7 +303,7 @@ impl<'a> CSerialize<'a> for Type {
303303
}
304304
TypeKind::Array(type_id, length) => {
305305
type_id.serialize(ctx, (), stack, writer)?;
306-
write!(writer, " [{length}]")?
306+
write!(writer, " [{length}]")?;
307307
}
308308
TypeKind::Function(signature) => {
309309
if self.is_const() {
@@ -341,22 +341,22 @@ impl<'a> CSerialize<'a> for Type {
341341
type_id.serialize(ctx, (), &mut stack, buf)
342342
},
343343
)?;
344-
write!(writer, ")")?
344+
write!(writer, ")")?;
345345
}
346346
}
347347
TypeKind::ResolvedTypeRef(type_id) => {
348348
if self.is_const() {
349349
write!(writer, "const ")?;
350350
}
351-
type_id.serialize(ctx, (), stack, writer)?
351+
type_id.serialize(ctx, (), stack, writer)?;
352352
}
353353
TypeKind::Pointer(type_id) => {
354354
if self.is_const() {
355355
stack.push("*const ".to_owned());
356356
} else {
357357
stack.push("*".to_owned());
358358
}
359-
type_id.serialize(ctx, (), stack, writer)?
359+
type_id.serialize(ctx, (), stack, writer)?;
360360
}
361361
TypeKind::Comp(comp_info) => {
362362
if self.is_const() {

bindgen/ir/analysis/has_vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl ops::BitOr for HasVtableResult {
4040

4141
impl ops::BitOrAssign for HasVtableResult {
4242
fn bitor_assign(&mut self, rhs: HasVtableResult) {
43-
*self = self.join(rhs)
43+
*self = self.join(rhs);
4444
}
4545
}
4646

bindgen/ir/analysis/sizedness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl ops::BitOr for SizednessResult {
8080

8181
impl ops::BitOrAssign for SizednessResult {
8282
fn bitor_assign(&mut self, rhs: SizednessResult) {
83-
*self = self.join(rhs)
83+
*self = self.join(rhs);
8484
}
8585
}
8686

bindgen/ir/analysis/template_params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
480480
extra_assert!(dependencies.contains_key(&sub_item));
481481
},
482482
&(),
483-
)
483+
);
484484
}
485485
}
486486

bindgen/ir/annotations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl Annotations {
227227
"replaces" => {
228228
self.use_instead_of = Some(
229229
attr.value.split("::").map(Into::into).collect(),
230-
)
230+
);
231231
}
232232
"derive" => self.derives.push(attr.value),
233233
"attribute" => self.attributes.push(attr.value),
@@ -239,7 +239,7 @@ impl Annotations {
239239
};
240240
}
241241
"accessor" => {
242-
self.accessor_kind = Some(parse_accessor(&attr.value))
242+
self.accessor_kind = Some(parse_accessor(&attr.value));
243243
}
244244
"constant" => self.constify_enum_variant = true,
245245
_ => {}

bindgen/ir/comp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ impl CompInfo {
16991699
layout: Option<&Layout>,
17001700
) {
17011701
let packed = self.is_packed(ctx, layout);
1702-
self.fields.compute_bitfield_units(ctx, packed)
1702+
self.fields.compute_bitfield_units(ctx, packed);
17031703
}
17041704

17051705
/// Assign for each anonymous field a generated name.

bindgen/ir/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
22622262
let mut module_name = None;
22632263
let spelling = cursor.spelling();
22642264
if !spelling.is_empty() {
2265-
module_name = Some(spelling)
2265+
module_name = Some(spelling);
22662266
}
22672267

22682268
let mut kind = ModuleKind::Normal;
@@ -2647,7 +2647,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
26472647

26482648
/// Call if a bindgen complex is generated
26492649
pub(crate) fn generated_bindgen_complex(&self) {
2650-
self.generated_bindgen_complex.set(true)
2650+
self.generated_bindgen_complex.set(true);
26512651
}
26522652

26532653
/// Whether we need to generate the bindgen complex type
@@ -2657,7 +2657,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
26572657

26582658
/// Call if a bindgen float16 is generated
26592659
pub(crate) fn generated_bindgen_float16(&self) {
2660-
self.generated_bindgen_float16.set(true)
2660+
self.generated_bindgen_float16.set(true);
26612661
}
26622662

26632663
/// Whether we need to generate the bindgen float16 type

bindgen/ir/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,6 @@ impl ops::BitOr for CanDerive {
125125

126126
impl ops::BitOrAssign for CanDerive {
127127
fn bitor_assign(&mut self, rhs: Self) {
128-
*self = self.join(rhs)
128+
*self = self.join(rhs);
129129
}
130130
}

bindgen/ir/module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ impl ClangSubItemParser for Module {
8484
let module_id = ctx.module(cursor);
8585
ctx.with_module(module_id, |ctx| {
8686
cursor.visit_sorted(ctx, |ctx, child| {
87-
parse_one(ctx, child, Some(module_id.into()))
88-
})
87+
parse_one(ctx, child, Some(module_id.into()));
88+
});
8989
});
9090

9191
Ok(ParseResult::AlreadyResolved(module_id.into()))

bindgen/ir/objc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl ObjCMethod {
308308
let arg = arg.to_string();
309309
let name_and_sig: Vec<&str> = arg.split(' ').collect();
310310
let name = name_and_sig[0];
311-
args_without_types.push(Ident::new(name, Span::call_site()))
311+
args_without_types.push(Ident::new(name, Span::call_site()));
312312
}
313313

314314
let args = split_name.into_iter().zip(args_without_types).map(

0 commit comments

Comments
 (0)