From 152a0cd224af73a373a221cdd721a2c98b1629a7 Mon Sep 17 00:00:00 2001 From: Marshall Pierce Date: Mon, 22 Feb 2021 10:09:19 -0700 Subject: [PATCH] Better names, style fixes --- onnxruntime-sys/build.rs | 2 +- onnxruntime/src/error.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/onnxruntime-sys/build.rs b/onnxruntime-sys/build.rs index a3eafb7b..32e99304 100644 --- a/onnxruntime-sys/build.rs +++ b/onnxruntime-sys/build.rs @@ -105,7 +105,7 @@ fn generate_bindings(include_dir: &Path) { .expect("Couldn't write bindings!"); } -fn download>(source_url: &str, target_file: P) { +fn download

(source_url: &str, target_file: P) where P: AsRef { let resp = ureq::get(source_url) .timeout_connect(1_000) // 1 second .timeout(std::time::Duration::from_secs(300)) diff --git a/onnxruntime/src/error.rs b/onnxruntime/src/error.rs index 38353159..0877d881 100644 --- a/onnxruntime/src/error.rs +++ b/onnxruntime/src/error.rs @@ -192,8 +192,9 @@ pub(crate) fn status_to_result( } /// A wrapper around a function on OrtApi that maps the status code into [OrtApiError] -pub(crate) unsafe fn call_ort *const sys::OrtStatus>( - mut block: F, -) -> std::result::Result<(), OrtApiError> { - status_to_result(block(g_ort())) +pub(crate) unsafe fn call_ort(mut f: F) -> std::result::Result<(), OrtApiError> +where + F: FnMut(sys::OrtApi) -> *const sys::OrtStatus, +{ + status_to_result(f(g_ort())) }