Skip to content

Commit

Permalink
fix: appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Jan 13, 2025
1 parent f6faa1b commit 3fa1aad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.70"
msrv = "1.72"
2 changes: 1 addition & 1 deletion ort-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ort-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions src/operator/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl KernelAttributes {

pub fn get<'s, T: GetKernelAttribute<'s>>(&'s self, name: impl AsRef<str>) -> Option<T> {
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<Vec<Input>> {
Expand Down Expand Up @@ -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<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized;
}

impl GetKernelAttribute<'_> for f32 {
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand All @@ -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<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand All @@ -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<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand All @@ -147,7 +147,7 @@ impl GetKernelAttribute<'_> for String {
}

impl GetKernelAttribute<'_> for Vec<f32> {
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand All @@ -160,7 +160,7 @@ impl GetKernelAttribute<'_> for Vec<f32> {
}

impl GetKernelAttribute<'_> for Vec<i64> {
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand All @@ -173,7 +173,7 @@ impl GetKernelAttribute<'_> for Vec<i64> {
}

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<Self>
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
where
Self: Sized
{
Expand Down

0 comments on commit 3fa1aad

Please sign in to comment.