Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving clippy warning #135

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(),
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
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)> + '_ {
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
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) {
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
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))
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
.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
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
}

/// 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)
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
.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;
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
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() {
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
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() {
allaboutevemirolive marked this conversation as resolved.
Show resolved Hide resolved
self.add_one_byte(byte);
if self.ascii_case_insensitive {
self.add_one_byte(opposite_ascii_case(byte));
Expand Down