Skip to content

Commit

Permalink
lint: resolve a few Clippy warnings
Browse files Browse the repository at this point in the history
These changes only reflect a subset that I agreed with.

PR #135
  • Loading branch information
allaboutevemirolive committed Mar 27, 2024
1 parent 56256dc commit cd400ad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/dfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl Builder {
matches: vec![vec![]; num_match_states],
matches_memory_usage: 0,
pattern_lens: nnfa.pattern_lens_raw().to_vec(),
prefilter: nnfa.prefilter().map(|p| p.clone()),
prefilter: nnfa.prefilter().cloned(),
match_kind: nnfa.match_kind(),
state_len,
alphabet_len: byte_classes.alphabet_len(),
Expand Down
2 changes: 1 addition & 1 deletion src/nfa/contiguous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl<'a> State<'a> {

/// Return an iterator over every explicitly defined transition in this
/// state.
fn transitions<'b>(&'b self) -> impl Iterator<Item = (u8, StateID)> + 'b {
fn transitions(&self) -> impl Iterator<Item = (u8, StateID)> + '_ {
let mut i = 0;
core::iter::from_fn(move || match self.trans {
StateTrans::Sparse { classes, nexts } => {
Expand Down
2 changes: 1 addition & 1 deletion src/packed/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl<'s, 'h> Iterator for FindIter<'s, 'h> {
if self.span.start > self.span.end {
return None;
}
match self.searcher.find_in(&self.haystack, self.span) {
match self.searcher.find_in(self.haystack, self.span) {
None => None,
Some(m) => {
self.span.start = m.end();
Expand Down
4 changes: 2 additions & 2 deletions src/packed/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub(crate) struct Pattern<'a>(&'a [u8]);
impl<'a> fmt::Debug for Pattern<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Pattern")
.field("lit", &String::from_utf8_lossy(&self.0))
.field("lit", &String::from_utf8_lossy(self.0))
.finish()
}
}
Expand All @@ -224,7 +224,7 @@ impl<'p> Pattern<'p> {

/// Returns the bytes of this pattern.
pub(crate) fn bytes(&self) -> &[u8] {
&self.0
self.0
}

/// Returns the first `len` low nybbles from this pattern. If this pattern
Expand Down
8 changes: 4 additions & 4 deletions src/util/prefilter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ struct Packed(packed::Searcher);
impl PrefilterI for Packed {
fn find_in(&self, haystack: &[u8], span: Span) -> Candidate {
self.0
.find_in(&haystack, span)
.find_in(haystack, span)
.map_or(Candidate::None, Candidate::Match)
}
}
Expand Down Expand Up @@ -549,7 +549,7 @@ impl RareBytesBuilder {
let (mut bytes, mut len) = ([0; 3], 0);
for b in 0..=255 {
if builder.rare_set.contains(b) {
bytes[len] = b as u8;
bytes[len] = b;
len += 1;
}
}
Expand Down Expand Up @@ -604,7 +604,7 @@ impl RareBytesBuilder {
self.available = false;
return;
}
let mut rarest = match bytes.get(0) {
let mut rarest = match bytes.first() {
None => return,
Some(&b) => (b, freq_rank(b)),
};
Expand Down Expand Up @@ -835,7 +835,7 @@ impl StartBytesBuilder {
if self.count > 3 {
return;
}
if let Some(&byte) = bytes.get(0) {
if let Some(&byte) = bytes.first() {
self.add_one_byte(byte);
if self.ascii_case_insensitive {
self.add_one_byte(opposite_ascii_case(byte));
Expand Down

0 comments on commit cd400ad

Please sign in to comment.