Skip to content

Commit

Permalink
match_address: moved call to iter.peek().copied() to where it's actua…
Browse files Browse the repository at this point in the history
…lly used.
  • Loading branch information
maxnoel committed Dec 30, 2022
1 parent 630c57e commit 185c882
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,11 @@ impl Matcher {
let mut iter = self.pattern_parts.iter().peekable();

while !remainder.is_empty() && let Some(part) = iter.next() {
let next = iter.peek().copied();
// Match the the address component by component
let result = match part {
AddressPatternComponent::Tag(s) => match_literally(remainder, s),
AddressPatternComponent::WildcardSingle => match_wildcard_single(remainder),
AddressPatternComponent::Wildcard(l) => match_wildcard(remainder, *l, next),
AddressPatternComponent::Wildcard(l) => match_wildcard(remainder, *l, iter.peek().copied()),
AddressPatternComponent::CharacterClass(cc) => match_character_class(remainder, cc),
AddressPatternComponent::Choice(s) => match_choice(remainder, s),
};
Expand Down

0 comments on commit 185c882

Please sign in to comment.