From 3fa1aad74e63f96b503ac6c32dc04de6abab829a Mon Sep 17 00:00:00 2001 From: "Carson M." Date: Mon, 13 Jan 2025 17:33:25 -0600 Subject: [PATCH] fix: appease clippy --- clippy.toml | 2 +- ort-sys/Cargo.toml | 2 +- ort-sys/build.rs | 4 ++-- src/operator/kernel.rs | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clippy.toml b/clippy.toml index 5d37e5d8..ebba0354 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.70" +msrv = "1.72" diff --git a/ort-sys/Cargo.toml b/ort-sys/Cargo.toml index 48b98278..08fadaf9 100644 --- a/ort-sys/Cargo.toml +++ b/ort-sys/Cargo.toml @@ -3,7 +3,7 @@ name = "ort-sys" description = "Unsafe Rust bindings for ONNX Runtime 1.20 - Optimize and Accelerate Machine Learning Inferencing" version = "2.0.0-rc.9" edition = "2021" -rust-version = "1.70" +rust-version = "1.72" links = "onnxruntime" license = "MIT OR Apache-2.0" repository = "https://github.com/pykeio/ort" diff --git a/ort-sys/build.rs b/ort-sys/build.rs index 740c3ce7..634d8a38 100644 --- a/ort-sys/build.rs +++ b/ort-sys/build.rs @@ -91,8 +91,8 @@ fn copy_libraries(lib_dir: &Path, out_dir: &Path) { let lib_files = std::fs::read_dir(lib_dir).unwrap_or_else(|_| panic!("Failed to read contents of `{}` (does it exist?)", lib_dir.display())); for lib_file in lib_files.filter(|e| { - e.as_ref().ok().map_or(false, |e| { - e.file_type().map_or(false, |e| !e.is_dir()) && [".dll", ".so", ".dylib"].into_iter().any(|v| e.path().to_string_lossy().contains(v)) + e.as_ref().ok().is_some_and(|e| { + e.file_type().is_ok_and(|e| !e.is_dir()) && [".dll", ".so", ".dylib"].into_iter().any(|v| e.path().to_string_lossy().contains(v)) }) }) { let lib_file = lib_file.unwrap(); diff --git a/src/operator/kernel.rs b/src/operator/kernel.rs index fc3ed134..47c35de7 100644 --- a/src/operator/kernel.rs +++ b/src/operator/kernel.rs @@ -35,7 +35,7 @@ impl KernelAttributes { pub fn get<'s, T: GetKernelAttribute<'s>>(&'s self, name: impl AsRef) -> Option { let name = CString::new(name.as_ref()).ok()?; - T::get_from(self.0.as_ptr(), name.as_ptr()) + unsafe { T::get_from(self.0.as_ptr(), name.as_ptr()) } } pub fn inputs(&self) -> Result> { @@ -106,13 +106,13 @@ impl AsPointer for KernelAttributes { } pub trait GetKernelAttribute<'s> { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized; } impl GetKernelAttribute<'_> for f32 { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized { @@ -123,7 +123,7 @@ impl GetKernelAttribute<'_> for f32 { } impl GetKernelAttribute<'_> for i64 { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized { @@ -134,7 +134,7 @@ impl GetKernelAttribute<'_> for i64 { } impl GetKernelAttribute<'_> for String { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized { @@ -147,7 +147,7 @@ impl GetKernelAttribute<'_> for String { } impl GetKernelAttribute<'_> for Vec { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized { @@ -160,7 +160,7 @@ impl GetKernelAttribute<'_> for Vec { } impl GetKernelAttribute<'_> for Vec { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized { @@ -173,7 +173,7 @@ impl GetKernelAttribute<'_> for Vec { } impl<'s, T: DowncastableTarget> GetKernelAttribute<'s> for ValueRef<'s, T> { - fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option + unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option where Self: Sized {