From 62827123eae0afcaee0bcbcd2ac1347d06d442e0 Mon Sep 17 00:00:00 2001 From: LippsApple Date: Fri, 23 Aug 2024 10:16:56 +0800 Subject: [PATCH] fix warn and cargo clippy --- matcher_py/test/test_simple_matcher.py | 7 ++++--- matcher_rs/src/simple_matcher.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/matcher_py/test/test_simple_matcher.py b/matcher_py/test/test_simple_matcher.py index 0e22745..0772637 100644 --- a/matcher_py/test/test_simple_matcher.py +++ b/matcher_py/test/test_simple_matcher.py @@ -37,12 +37,13 @@ def test_init_with_invalid_map(): SimpleMatcher(json_encoder.encode({"a": {"b": 1}})) SimpleMatcher(json_encoder.encode({1: []})) + def test_backslashes(): simple_matcher = SimpleMatcher( - json_encoder.encode({ProcessType.MatchNone: {1: "It's /\/\y duty"}}) + json_encoder.encode({ProcessType.MatchNone: {1: r"It's /\/\y duty"}}) ) - assert simple_matcher.is_match("It's /\/\y duty") - assert simple_matcher.process("It's /\/\y duty")[0]["word"] == "It's /\/\y duty" + assert simple_matcher.is_match(r"It's /\/\y duty") + assert simple_matcher.process(r"It's /\/\y duty")[0]["word"] == r"It's /\/\y duty" def test_fanjian(): diff --git a/matcher_rs/src/simple_matcher.rs b/matcher_rs/src/simple_matcher.rs index e23f30a..bb356c2 100644 --- a/matcher_rs/src/simple_matcher.rs +++ b/matcher_rs/src/simple_matcher.rs @@ -464,8 +464,8 @@ impl<'a> TextMatcherTrait<'a, SimpleResult<'a>> for SimpleMatcher { word_id_split_bit_map.values().any(|split_bit_matrix| { split_bit_matrix - .into_iter() - .all(|split_bit_vec| split_bit_vec.into_iter().any(|&split_bit| split_bit <= 0)) + .iter() + .all(|split_bit_vec| split_bit_vec.iter().any(|&split_bit| split_bit <= 0)) }) }