diff --git a/rust/src/events/mod.rs b/rust/src/events/mod.rs index 06665bdd06..64476a9c7b 100644 --- a/rust/src/events/mod.rs +++ b/rust/src/events/mod.rs @@ -22,11 +22,11 @@ use std::{ collections::HashMap, - sync::{Arc, Mutex, RwLock}, + sync::{Arc, RwLock}, }; use pyo3::{ - exceptions::{PyKeyError, PyTypeError}, + exceptions::PyKeyError, pyclass, pymethods, types::{PyAnyMethods, PyIterator, PyMapping, PyMappingMethods, PyModule, PyModuleMethods}, wrap_pyfunction, Bound, IntoPyObject, PyAny, PyResult, Python, @@ -71,7 +71,7 @@ impl JsonObject { #[new] fn new<'a, 'py>(object: &'a Bound<'py, PyAny>) -> PyResult { Ok(Self { - object: Arc::new(depythonize(&object)?), + object: Arc::new(depythonize(object)?), }) } @@ -175,26 +175,26 @@ impl Signatures { fn keys<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); - Ok(signatures + signatures .keys() .map(|k| &**k) .collect::>() - .into_pyobject(py)?) + .into_pyobject(py) } fn values<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); - Ok(signatures + signatures .values() .cloned() .collect::>() - .into_pyobject(py)?) + .into_pyobject(py) } fn items<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); let items: Vec<_> = signatures.iter().map(|(k, v)| (&**k, v.clone())).collect(); - Ok(items.into_pyobject(py)?) + items.into_pyobject(py) } #[pyo3(signature = (key, default=None))] @@ -257,11 +257,11 @@ impl DomainSignatures { // iterator type. let signatures = self.signatures.read().unwrap(); - Ok(signatures + signatures .keys() .map(|k| &**k) .collect::>() - .into_pyobject(py)?) + .into_pyobject(py) } fn __contains__(&self, key: &str) -> bool { @@ -284,26 +284,26 @@ impl DomainSignatures { fn keys<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); - Ok(signatures + signatures .keys() .map(|k| &**k) .collect::>() - .into_pyobject(py)?) + .into_pyobject(py) } fn values<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); - Ok(signatures + signatures .values() .map(|v| &**v) .collect::>() - .into_pyobject(py)?) + .into_pyobject(py) } fn items<'py>(&self, py: Python<'py>) -> PyResult> { let signatures = self.signatures.read().unwrap(); let items: Vec<_> = signatures.iter().map(|(k, v)| (&**k, &**v)).collect(); - Ok(items.into_pyobject(py)?) + items.into_pyobject(py) } #[pyo3(signature = (key, default=None))] @@ -402,7 +402,7 @@ impl Event { } #[getter] - fn signatures<'py>(&self, py: Python<'py>) -> PyResult { + fn signatures(&self) -> PyResult { match &self.inner { EventFormatEnum::V3(format) => Ok(format.common_fields.signatures.clone()), // ...