Skip to content

Commit

Permalink
Fix clippy in release build (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Jan 6, 2025
1 parent 2f36adb commit 08c77c7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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(())
Expand Down

0 comments on commit 08c77c7

Please sign in to comment.