Skip to content

Commit a392a19

Browse files
committed
Fix warnings.
1 parent 4b9d661 commit a392a19

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

bindgen/clang.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,10 +1839,7 @@ impl Index {
18391839
pub(crate) fn new(pch: bool, diag: bool) -> Index {
18401840
unsafe {
18411841
Index {
1842-
x: clang_createIndex(
1843-
pch.try_into().unwrap(),
1844-
diag.try_into().unwrap(),
1845-
),
1842+
x: clang_createIndex(pch.into(), diag.into()),
18461843
}
18471844
}
18481845
}
@@ -1917,7 +1914,7 @@ impl TranslationUnit {
19171914
let mut diags = vec![];
19181915
for i in 0..num {
19191916
diags.push(Diagnostic {
1920-
x: clang_getDiagnostic(self.x, i.try_into().unwrap()),
1917+
x: clang_getDiagnostic(self.x, i),
19211918
});
19221919
}
19231920
diags
@@ -2324,10 +2321,12 @@ impl EvalResult {
23242321

23252322
if unsafe { clang_EvalResult_isUnsignedInt(self.x) } != 0 {
23262323
let value = unsafe { clang_EvalResult_getAsUnsigned(self.x) };
2324+
#[allow(clippy::unnecessary_fallible_conversions)]
23272325
return i128::try_from(value).ok();
23282326
}
23292327

23302328
let value = unsafe { clang_EvalResult_getAsLongLong(self.x) };
2329+
#[allow(clippy::unnecessary_fallible_conversions)]
23312330
i128::try_from(value).ok()
23322331
}
23332332

bindgen/codegen/macro_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl CodeGenerator for MacroDef {
117117
}
118118
result.saw_var_macro(name);
119119

120-
let canonical_ident = ctx.rust_ident(&canonical_name);
120+
let canonical_ident = ctx.rust_ident(canonical_name);
121121

122122
let mut var_macro = match ctx.macro_set.expand_var_macro(name) {
123123
Ok(body) => match VarMacro::parse(name, &body) {

bindgen/ir/comp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ where
592592
const is_ms_struct: bool = false;
593593

594594
for bitfield in raw_bitfields {
595-
let bitfield_width = bitfield.bitfield_width().unwrap() as usize;
595+
let bitfield_width = bitfield.bitfield_width().unwrap();
596596
let bitfield_layout =
597597
ctx.resolve_type(bitfield.ty()).layout(ctx).ok_or(())?;
598598
let bitfield_size = bitfield_layout.size;

0 commit comments

Comments
 (0)