diff --git a/crates/vectorless-py/src/document.rs b/crates/vectorless-py/src/document.rs index 1145893..9a571aa 100644 --- a/crates/vectorless-py/src/document.rs +++ b/crates/vectorless-py/src/document.rs @@ -5,8 +5,8 @@ use std::sync::Arc; -use pyo3::prelude::*; use pyo3::exceptions::PyRuntimeError; +use pyo3::prelude::*; use pyo3_async_runtimes::tokio::future_into_py; use tokio::sync::Mutex; @@ -380,9 +380,7 @@ impl PyDocument { future_into_py(py, async move { let num = node_id .strip_prefix('n') - .ok_or_else(|| { - PyRuntimeError::new_err("NodeId must start with 'n'") - })? + .ok_or_else(|| PyRuntimeError::new_err("NodeId must start with 'n'"))? .parse::() .map_err(|_| PyRuntimeError::new_err("Invalid NodeId"))?; let nav = nav.lock().await; @@ -401,9 +399,7 @@ impl PyDocument { future_into_py(py, async move { let num = node_id .strip_prefix('n') - .ok_or_else(|| { - PyRuntimeError::new_err("NodeId must start with 'n'") - })? + .ok_or_else(|| PyRuntimeError::new_err("NodeId must start with 'n'"))? .parse::() .map_err(|_| PyRuntimeError::new_err("Invalid NodeId"))?; let nav = nav.lock().await; @@ -422,9 +418,7 @@ impl PyDocument { future_into_py(py, async move { let num = node_id .strip_prefix('n') - .ok_or_else(|| { - PyRuntimeError::new_err("NodeId must start with 'n'") - })? + .ok_or_else(|| PyRuntimeError::new_err("NodeId must start with 'n'"))? .parse::() .map_err(|_| PyRuntimeError::new_err("Invalid NodeId"))?; let nav = nav.lock().await; diff --git a/crates/vectorless-py/src/engine.rs b/crates/vectorless-py/src/engine.rs index 229016b..065af2f 100644 --- a/crates/vectorless-py/src/engine.rs +++ b/crates/vectorless-py/src/engine.rs @@ -3,8 +3,8 @@ //! Engine Python wrapper — async compile/forget/list_documents. -use pyo3::prelude::*; use pyo3::exceptions::PyRuntimeError; +use pyo3::prelude::*; use pyo3_async_runtimes::tokio::future_into_py; use std::sync::Arc; use tokio::runtime::Runtime; @@ -73,7 +73,9 @@ async fn run_load_document(engine: Arc, doc_id: String) -> PyResult Err(PyRuntimeError::new_err(format!("Document not found: {doc_id}"))), + None => Err(PyRuntimeError::new_err(format!( + "Document not found: {doc_id}" + ))), } } @@ -166,9 +168,8 @@ impl PyEngine { builder.build().await }); - let engine = engine.map_err(|e| { - PyRuntimeError::new_err(format!("Failed to create engine: {}", e)) - })?; + let engine = engine + .map_err(|e| PyRuntimeError::new_err(format!("Failed to create engine: {}", e)))?; Ok(Self { inner: Arc::new(engine),