mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2024-12-04 05:22:20 +00:00
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.
This commit is contained in:
parent
c424e03415
commit
142f62abdf
2
.github/workflows/bindgen.yml
vendored
2
.github/workflows/bindgen.yml
vendored
@ -9,7 +9,7 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
rustfmt:
|
||||
rustfmt-clippy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user