Skip to content

Commit 6f0b754

Browse files
nyurikpvdrz
authored andcommitted
Linting semicolons
``` cargo clippy --workspace --fix --all-targets -- -A clippy::all -W clippy::semicolon_if_nothing_returned ```
1 parent fab3026 commit 6f0b754

File tree

24 files changed

+61
-60
lines changed

24 files changed

+61
-60
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/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ objc = "0.2"
2121
# deprecated = "allow"
2222
# invalid-value = "allow"
2323
# unsupported_calling_conventions = "allow"
24+
dead_code = "allow"
2425
non-snake-case = "allow"
26+
non_camel_case_types = "allow"
27+
non_upper_case_globals = "allow"
2528
unexpected-cfgs = "allow"
2629

2730
[lints.clippy]
@@ -30,6 +33,7 @@ manual-c-str-literals = "allow"
3033
missing-safety-doc = "allow"
3134
op-ref = "allow"
3235
ptr-offset-with-cast = "allow"
36+
semicolon_if_nothing_returned = "allow"
3337
too-many-arguments = "allow"
3438
transmute-int-to-bool = "allow"
3539
unnecessary-cast = "allow"
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
#![allow(dead_code)]
2-
#![allow(non_camel_case_types)]
3-
#![allow(non_upper_case_globals)]

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 {
@@ -1141,7 +1141,7 @@ impl CodeGenerator for Type {
11411141
result.saw_objc();
11421142
}
11431143
TypeKind::ObjCInterface(ref interface) => {
1144-
interface.codegen(ctx, result, item)
1144+
interface.codegen(ctx, result, item);
11451145
}
11461146
ref u @ TypeKind::UnresolvedTypeRef(..) => {
11471147
unreachable!("Should have been resolved after parsing {u:?}!")
@@ -1228,7 +1228,7 @@ impl CodeGenerator for Vtable<'_> {
12281228
pub struct #name {
12291229
#( #methods ),*
12301230
}
1231-
})
1231+
});
12321232
} else {
12331233
// For the cases we don't support, simply generate an empty struct.
12341234
let void = helpers::ast_ty::c_void(ctx);
@@ -2321,7 +2321,7 @@ impl CodeGenerator for CompInfo {
23212321
let ty = helpers::blob(layout);
23222322
fields.push(quote! {
23232323
pub bindgen_union_field: #ty ,
2324-
})
2324+
});
23252325
}
23262326
}
23272327

@@ -2470,7 +2470,7 @@ impl CodeGenerator for CompInfo {
24702470
derives.extend(custom_derives.iter().map(|s| s.as_str()));
24712471

24722472
if !derives.is_empty() {
2473-
attributes.push(attributes::derives(&derives))
2473+
attributes.push(attributes::derives(&derives));
24742474
}
24752475

24762476
attributes.extend(
@@ -3094,7 +3094,7 @@ impl Method {
30943094
quote! {
30953095
__bindgen_tmp
30963096
}
3097-
})
3097+
});
30983098
}
30993099

31003100
let block = ctx.wrap_unsafe_ops(quote! ( #( #stmts );*));
@@ -4754,7 +4754,7 @@ fn unsupported_abi_diagnostic(
47544754
}
47554755
}
47564756

4757-
diag.display()
4757+
diag.display();
47584758
}
47594759
}
47604760

@@ -4791,7 +4791,7 @@ fn variadic_fn_diagnostic(
47914791
}
47924792
}
47934793

4794-
diag.display()
4794+
diag.display();
47954795
}
47964796
}
47974797

@@ -5221,10 +5221,10 @@ pub(crate) mod utils {
52215221
}
52225222
match ty.kind() {
52235223
TypeKind::Alias(type_id_alias) => {
5224-
type_id = *type_id_alias
5224+
type_id = *type_id_alias;
52255225
}
52265226
TypeKind::ResolvedTypeRef(type_id_typedef) => {
5227-
type_id = *type_id_typedef
5227+
type_id = *type_id_typedef;
52285228
}
52295229
_ => break,
52305230
}
@@ -5705,7 +5705,7 @@ pub(crate) mod utils {
57055705
.collect::<Vec<_>>();
57065706

57075707
if is_variadic {
5708-
args.push(quote! { ... })
5708+
args.push(quote! { ... });
57095709
}
57105710

57115711
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
@@ -474,7 +474,7 @@ impl<'ctx> MonotoneFramework for UsedTemplateParameters<'ctx> {
474474
extra_assert!(dependencies.contains_key(&sub_item));
475475
},
476476
&(),
477-
)
477+
);
478478
}
479479
}
480480

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
@@ -1698,7 +1698,7 @@ impl CompInfo {
16981698
layout: Option<&Layout>,
16991699
) {
17001700
let packed = self.is_packed(ctx, layout);
1701-
self.fields.compute_bitfield_units(ctx, packed)
1701+
self.fields.compute_bitfield_units(ctx, packed);
17021702
}
17031703

17041704
/// 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
@@ -2238,7 +2238,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
22382238
let mut module_name = None;
22392239
let spelling = cursor.spelling();
22402240
if !spelling.is_empty() {
2241-
module_name = Some(spelling)
2241+
module_name = Some(spelling);
22422242
}
22432243

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

26222622
/// Call if a bindgen complex is generated
26232623
pub(crate) fn generated_bindgen_complex(&self) {
2624-
self.generated_bindgen_complex.set(true)
2624+
self.generated_bindgen_complex.set(true);
26252625
}
26262626

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

26322632
/// Call if a bindgen float16 is generated
26332633
pub(crate) fn generated_bindgen_float16(&self) {
2634-
self.generated_bindgen_float16.set(true)
2634+
self.generated_bindgen_float16.set(true);
26352635
}
26362636

26372637
/// 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
@@ -305,7 +305,7 @@ impl ObjCMethod {
305305
let arg = arg.to_string();
306306
let name_and_sig: Vec<&str> = arg.split(' ').collect();
307307
let name = name_and_sig[0];
308-
args_without_types.push(Ident::new(name, Span::call_site()))
308+
args_without_types.push(Ident::new(name, Span::call_site()));
309309
}
310310

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

bindgen/ir/traversal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ where
344344
F: FnMut(ItemId, EdgeKind),
345345
{
346346
fn visit_kind(&mut self, item: ItemId, kind: EdgeKind) {
347-
(*self)(item, kind)
347+
(*self)(item, kind);
348348
}
349349
}
350350

@@ -437,7 +437,7 @@ where
437437
let is_newly_discovered =
438438
self.seen.add(self.currently_traversing, item);
439439
if is_newly_discovered {
440-
self.queue.push(item)
440+
self.queue.push(item);
441441
}
442442
}
443443
}

0 commit comments

Comments
 (0)