Skip to content

Commit 142f62a

Browse files
committed
ci: clippy fixes.
The allowed casts are because c_longlong etc aren't guaranteed to map to i64 / etc. I believe c_double maps to f64 in all platforms tho.
1 parent c424e03 commit 142f62a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/bindgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- master
1010

1111
jobs:
12-
rustfmt:
12+
rustfmt-clippy:
1313
runs-on: ubuntu-latest
1414

1515
steps:

bindgen/clang.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ impl Cursor {
652652
pub fn enum_val_signed(&self) -> Option<i64> {
653653
unsafe {
654654
if self.kind() == CXCursor_EnumConstantDecl {
655+
#[allow(clippy::unnecessary_cast)]
655656
Some(clang_getEnumConstantDeclValue(self.x) as i64)
656657
} else {
657658
None
@@ -665,6 +666,7 @@ impl Cursor {
665666
pub fn enum_val_unsigned(&self) -> Option<u64> {
666667
unsafe {
667668
if self.kind() == CXCursor_EnumConstantDecl {
669+
#[allow(clippy::unnecessary_cast)]
668670
Some(clang_getEnumConstantDeclUnsignedValue(self.x) as u64)
669671
} else {
670672
None
@@ -2134,7 +2136,7 @@ impl EvalResult {
21342136
pub fn as_double(&self) -> Option<f64> {
21352137
match self.kind() {
21362138
CXEval_Float => {
2137-
Some(unsafe { clang_EvalResult_getAsDouble(self.x) } as f64)
2139+
Some(unsafe { clang_EvalResult_getAsDouble(self.x) })
21382140
}
21392141
_ => None,
21402142
}
@@ -2162,6 +2164,7 @@ impl EvalResult {
21622164
if value < i64::min_value() as c_longlong {
21632165
return None;
21642166
}
2167+
#[allow(clippy::unnecessary_cast)]
21652168
Some(value as i64)
21662169
}
21672170

0 commit comments

Comments
 (0)