Skip to content

Commit b253580

Browse files
committed
edition: run 'cargo fix --edition --edition-idioms'
1 parent 45a4ee7 commit b253580

11 files changed

Lines changed: 22 additions & 30 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ Add this to your `Cargo.toml`:
2828
aho-corasick = "0.7"
2929
```
3030

31-
and this to your crate root (if you're using Rust 2015):
32-
33-
```rust
34-
extern crate aho_corasick;
35-
```
36-
3731

3832
### Example: basic searching
3933

‎bench/src/bench.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
extern crate aho_corasick;
21
#[macro_use]
32
extern crate criterion;
43

@@ -159,7 +158,7 @@ fn define(
159158
group_name: &str,
160159
bench_name: &str,
161160
corpus: &[u8],
162-
bench: impl FnMut(&mut Bencher) + 'static,
161+
bench: impl FnMut(&mut Bencher<'_>) + 'static,
163162
) {
164163
let tput = Throughput::Bytes(corpus.len() as u64);
165164
let benchmark = Benchmark::new(bench_name, bench)
@@ -177,7 +176,7 @@ fn define_long(
177176
group_name: &str,
178177
bench_name: &str,
179178
corpus: &[u8],
180-
bench: impl FnMut(&mut Bencher) + 'static,
179+
bench: impl FnMut(&mut Bencher<'_>) + 'static,
181180
) {
182181
let tput = Throughput::Bytes(corpus.len() as u64);
183182
let benchmark = Benchmark::new(bench_name, bench)

‎src/ahocorasick.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ impl<S: StateID> Imp<S> {
11691169
///
11701170
/// The lifetime `'b` refers to the lifetime of the haystack being searched.
11711171
#[derive(Debug)]
1172-
pub struct FindIter<'a, 'b, S: 'a + StateID> {
1172+
pub struct FindIter<'a, 'b, S: StateID> {
11731173
fsm: &'a Imp<S>,
11741174
prestate: PrefilterState,
11751175
haystack: &'b [u8],
@@ -1226,7 +1226,7 @@ impl<'a, 'b, S: StateID> Iterator for FindIter<'a, 'b, S> {
12261226
///
12271227
/// The lifetime `'b` refers to the lifetime of the haystack being searched.
12281228
#[derive(Debug)]
1229-
pub struct FindOverlappingIter<'a, 'b, S: 'a + StateID> {
1229+
pub struct FindOverlappingIter<'a, 'b, S: StateID> {
12301230
fsm: &'a Imp<S>,
12311231
prestate: PrefilterState,
12321232
haystack: &'b [u8],
@@ -1297,7 +1297,7 @@ impl<'a, 'b, S: StateID> Iterator for FindOverlappingIter<'a, 'b, S> {
12971297
///
12981298
/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
12991299
#[derive(Debug)]
1300-
pub struct StreamFindIter<'a, R, S: 'a + StateID> {
1300+
pub struct StreamFindIter<'a, R, S: StateID> {
13011301
it: StreamChunkIter<'a, R, S>,
13021302
}
13031303

@@ -1332,7 +1332,7 @@ impl<'a, R: io::Read, S: StateID> Iterator for StreamFindIter<'a, R, S> {
13321332
/// N.B. This does not actually implement Iterator because we need to borrow
13331333
/// from the underlying reader. But conceptually, it's still an iterator.
13341334
#[derive(Debug)]
1335-
struct StreamChunkIter<'a, R, S: 'a + StateID> {
1335+
struct StreamChunkIter<'a, R, S: StateID> {
13361336
/// The AC automaton.
13371337
fsm: &'a Imp<S>,
13381338
/// State associated with this automaton's prefilter. It is a heuristic

‎src/classes.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl ByteClasses {
6464
/// hasn't been converted to equivalence classes yet. Picking an arbitrary
6565
/// byte from each equivalence class then permits a full exploration of
6666
/// the NFA instead of using every possible byte value.
67-
pub fn representatives(&self) -> ByteClassRepresentatives {
67+
pub fn representatives(&self) -> ByteClassRepresentatives<'_> {
6868
ByteClassRepresentatives { classes: self, byte: 0, last_class: None }
6969
}
7070

@@ -85,7 +85,7 @@ impl ByteClasses {
8585
}
8686

8787
impl fmt::Debug for ByteClasses {
88-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
88+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8989
if self.is_singleton() {
9090
write!(f, "ByteClasses({{singletons}})")
9191
} else {

‎src/error.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl error::Error for Error {
6868
}
6969

7070
impl fmt::Display for Error {
71-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
71+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7272
match self.kind {
7373
ErrorKind::StateIDOverflow { max } => write!(
7474
f,

‎src/lib.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ disabled via
186186
#[cfg(not(feature = "std"))]
187187
compile_error!("`std` feature is currently required to build this crate");
188188

189-
extern crate memchr;
190189
// #[cfg(doctest)]
191190
// #[macro_use]
192191
// extern crate doc_comment;

‎src/nfa.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<S: StateID> NFA<S> {
172172
self.state_mut(id)
173173
}
174174

175-
fn iter_transitions_mut(&mut self, id: S) -> IterTransitionsMut<S> {
175+
fn iter_transitions_mut(&mut self, id: S) -> IterTransitionsMut<'_, S> {
176176
IterTransitionsMut::new(self, id)
177177
}
178178

@@ -497,7 +497,7 @@ impl<S: StateID> Transitions<S> {
497497
/// is iterating over transitions, the caller can still mutate the NFA. This
498498
/// is useful when creating failure transitions.
499499
#[derive(Debug)]
500-
struct IterTransitionsMut<'a, S: StateID + 'a> {
500+
struct IterTransitionsMut<'a, S: StateID> {
501501
nfa: &'a mut NFA<S>,
502502
state_id: S,
503503
cur: usize,
@@ -1274,7 +1274,7 @@ impl Iterator for AllBytesIter {
12741274
}
12751275

12761276
impl<S: StateID> fmt::Debug for NFA<S> {
1277-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1277+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12781278
writeln!(f, "NFA(")?;
12791279
writeln!(f, "match_kind: {:?}", self.match_kind)?;
12801280
writeln!(f, "prefilter: {:?}", self.prefilter)?;

‎src/packed/pattern.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl Patterns {
155155

156156
/// Return the pattern with the given identifier. If such a pattern does
157157
/// not exist, then this panics.
158-
pub fn get(&self, id: PatternID) -> Pattern {
158+
pub fn get(&self, id: PatternID) -> Pattern<'_> {
159159
Pattern(&self.by_id[id as usize])
160160
}
161161

@@ -167,7 +167,7 @@ impl Patterns {
167167
/// Callers must ensure that a pattern with the given identifier exists
168168
/// before using this method.
169169
#[cfg(target_arch = "x86_64")]
170-
pub unsafe fn get_unchecked(&self, id: PatternID) -> Pattern {
170+
pub unsafe fn get_unchecked(&self, id: PatternID) -> Pattern<'_> {
171171
Pattern(self.by_id.get_unchecked(id as usize))
172172
}
173173

@@ -189,7 +189,7 @@ impl Patterns {
189189
/// the order provided by this iterator, then the result is guaranteed
190190
/// to satisfy the correct match semantics. (Either leftmost-first or
191191
/// leftmost-longest.)
192-
pub fn iter(&self) -> PatternIter {
192+
pub fn iter(&self) -> PatternIter<'_> {
193193
PatternIter { patterns: self, i: 0 }
194194
}
195195
}
@@ -226,7 +226,7 @@ impl<'p> Iterator for PatternIter<'p> {
226226
pub struct Pattern<'a>(&'a [u8]);
227227

228228
impl<'a> fmt::Debug for Pattern<'a> {
229-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
229+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
230230
f.debug_struct("Pattern")
231231
.field("lit", &String::from_utf8_lossy(&self.0))
232232
.finish()

‎src/packed/teddy/compile.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'p> Compiler<'p> {
296296
}
297297

298298
impl<'p> fmt::Debug for Compiler<'p> {
299-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
299+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
300300
let mut buckets = vec![vec![]; self.buckets.len()];
301301
for (i, bucket) in self.buckets.iter().enumerate() {
302302
for &patid in bucket {
@@ -400,7 +400,7 @@ impl Mask {
400400
}
401401

402402
impl fmt::Debug for Mask {
403-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
403+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
404404
let (mut parts_lo, mut parts_hi) = (vec![], vec![]);
405405
for i in 0..32 {
406406
parts_lo.push(format!("{:02}: {:08b}", i, self.lo[i]));

‎src/packed/teddy/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#[cfg(target_arch = "x86_64")]
22
pub use crate::packed::teddy::compile::Builder;
3+
#[cfg(target_arch = "x86_64")]
4+
pub use crate::packed::teddy::runtime::Teddy;
35
#[cfg(not(target_arch = "x86_64"))]
46
pub use packed::teddy::fallback::Builder;
57
#[cfg(not(target_arch = "x86_64"))]
68
pub use packed::teddy::fallback::Teddy;
7-
#[cfg(target_arch = "x86_64")]
8-
pub use crate::packed::teddy::runtime::Teddy;
99

1010
#[cfg(target_arch = "x86_64")]
1111
mod compile;

0 commit comments

Comments
 (0)