From 08c77c706374746e539084d6f92b7e5213abac2b Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Mon, 6 Jan 2025 15:36:53 -0800 Subject: [PATCH] Fix clippy in release build (#113) --- python/src/lib.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/python/src/lib.rs b/python/src/lib.rs index c904c23..4f3ed82 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -5,10 +5,7 @@ mod kdtree; mod rtree; pub(crate) mod util; -use pyo3::exceptions::PyRuntimeWarning; -use pyo3::intern; use pyo3::prelude::*; -use pyo3::types::PyTuple; const VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -19,15 +16,19 @@ fn ___version() -> &'static str { /// Raise RuntimeWarning for debug builds #[pyfunction] -fn check_debug_build(py: Python) -> PyResult<()> { +fn check_debug_build(_py: Python) -> PyResult<()> { #[cfg(debug_assertions)] { - let warnings_mod = py.import(intern!(py, "warnings"))?; + use pyo3::exceptions::PyRuntimeWarning; + use pyo3::intern; + use pyo3::types::PyTuple; + + let warnings_mod = _py.import(intern!(_py, "warnings"))?; let warning = PyRuntimeWarning::new_err( "geoindex-rs has not been compiled in release mode. Performance will be degraded.", ); - let args = PyTuple::new(py, vec![warning])?; - warnings_mod.call_method1(intern!(py, "warn"), args)?; + let args = PyTuple::new(_py, vec![warning])?; + warnings_mod.call_method1(intern!(_py, "warn"), args)?; } Ok(())