summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2022-10-16 20:59:57 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-10-16 21:29:41 +0200
commit142f62abdf452d4d6a8cb00215ec465af80434ff (patch)
tree80de6ca1520f509a3d0a7831e0768a8b029e3975
parentc424e034155660348ed77cfa92ec9869f617a625 (diff)
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.
-rw-r--r--.github/workflows/bindgen.yml2
-rw-r--r--bindgen/clang.rs5
2 files changed, 5 insertions, 2 deletions
diff --git a/.github/workflows/bindgen.yml b/.github/workflows/bindgen.yml
index 94a338bf..bc8477d5 100644
--- a/.github/workflows/bindgen.yml
+++ b/.github/workflows/bindgen.yml
@@ -9,7 +9,7 @@ on:
- master
jobs:
- rustfmt:
+ rustfmt-clippy:
runs-on: ubuntu-latest
steps:
diff --git a/bindgen/clang.rs b/bindgen/clang.rs
index e5113391..ae140520 100644
--- a/bindgen/clang.rs
+++ b/bindgen/clang.rs
@@ -652,6 +652,7 @@ impl Cursor {
pub fn enum_val_signed(&self) -> Option<i64> {
unsafe {
if self.kind() == CXCursor_EnumConstantDecl {
+ #[allow(clippy::unnecessary_cast)]
Some(clang_getEnumConstantDeclValue(self.x) as i64)
} else {
None
@@ -665,6 +666,7 @@ impl Cursor {
pub fn enum_val_unsigned(&self) -> Option<u64> {
unsafe {
if self.kind() == CXCursor_EnumConstantDecl {
+ #[allow(clippy::unnecessary_cast)]
Some(clang_getEnumConstantDeclUnsignedValue(self.x) as u64)
} else {
None
@@ -2134,7 +2136,7 @@ impl EvalResult {
pub fn as_double(&self) -> Option<f64> {
match self.kind() {
CXEval_Float => {
- Some(unsafe { clang_EvalResult_getAsDouble(self.x) } as f64)
+ Some(unsafe { clang_EvalResult_getAsDouble(self.x) })
}
_ => None,
}
@@ -2162,6 +2164,7 @@ impl EvalResult {
if value < i64::min_value() as c_longlong {
return None;
}
+ #[allow(clippy::unnecessary_cast)]
Some(value as i64)
}