Skip to content

Commit

Permalink
fix warn and cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lips7 committed Aug 23, 2024
1 parent e7c65d2 commit 6282712
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions matcher_py/test/test_simple_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions matcher_rs/src/simple_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
}

Expand Down

0 comments on commit 6282712

Please sign in to comment.