From 869408aacf3fbc8557cfe70678b1a7eb4dd8d39f Mon Sep 17 00:00:00 2001 From: John Parton Date: Fri, 13 Oct 2023 15:12:27 -0500 Subject: [PATCH] cargo fmt --- src/lib.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2d20442..c61a2a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ fn _fix_encoding_name(encoding: &str) -> &str { } #[doc = include_str!("../chardetng_docs/EncodingDetector.md")] -#[pyclass(name="EncodingDetector")] +#[pyclass(name = "EncodingDetector")] struct EncodingDetectorWrapper { encoding_detector: EncodingDetector, } @@ -28,7 +28,7 @@ impl EncodingDetectorWrapper { #[new] fn new() -> Self { EncodingDetectorWrapper { - encoding_detector: EncodingDetector::new() + encoding_detector: EncodingDetector::new(), } } @@ -41,26 +41,18 @@ impl EncodingDetectorWrapper { #[doc = include_str!("../chardetng_docs/guess.md")] #[pyo3(signature=(*, tld, allow_utf8))] fn guess(&self, tld: Option<&[u8]>, allow_utf8: bool) -> &'static str { - - _fix_encoding_name( - self.encoding_detector.guess(tld, allow_utf8).name() - ) + _fix_encoding_name(self.encoding_detector.guess(tld, allow_utf8).name()) } #[doc = include_str!("../chardetng_docs/guess_assess.md")] #[pyo3(signature=(*, tld, allow_utf8))] fn guess_assess(&self, tld: Option<&[u8]>, allow_utf8: bool) -> (&'static str, bool) { - let (encoding, higher_score) = self.encoding_detector.guess_assess(tld, allow_utf8); - ( - _fix_encoding_name(encoding.name()), - higher_score - ) + (_fix_encoding_name(encoding.name()), higher_score) } } - #[pymodule] fn detector(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?;