summaryrefslogtreecommitdiffstats
path: root/crates/searcher
diff options
context:
space:
mode:
Diffstat (limited to 'crates/searcher')
-rw-r--r--crates/searcher/examples/search-stdin.rs3
-rw-r--r--crates/searcher/src/lib.rs8
-rw-r--r--crates/searcher/src/searcher/glue.rs6
-rw-r--r--crates/searcher/src/searcher/mod.rs2
-rw-r--r--crates/searcher/src/sink.rs18
-rw-r--r--crates/searcher/src/testutil.rs4
6 files changed, 15 insertions, 26 deletions
diff --git a/crates/searcher/examples/search-stdin.rs b/crates/searcher/examples/search-stdin.rs
index cd0bc4e8..8034ae6c 100644
--- a/crates/searcher/examples/search-stdin.rs
+++ b/crates/searcher/examples/search-stdin.rs
@@ -1,6 +1,3 @@
-extern crate grep_regex;
-extern crate grep_searcher;
-
use std::env;
use std::error::Error;
use std::io;
diff --git a/crates/searcher/src/lib.rs b/crates/searcher/src/lib.rs
index c17f47f8..49c7e2a4 100644
--- a/crates/searcher/src/lib.rs
+++ b/crates/searcher/src/lib.rs
@@ -99,16 +99,8 @@ searches stdin.
#![deny(missing_docs)]
-extern crate bstr;
-extern crate bytecount;
-extern crate encoding_rs;
-extern crate encoding_rs_io;
-extern crate grep_matcher;
#[macro_use]
extern crate log;
-extern crate memmap;
-#[cfg(test)]
-extern crate regex;
pub use crate::lines::{LineIter, LineStep};
pub use crate::searcher::{
diff --git a/crates/searcher/src/searcher/glue.rs b/crates/searcher/src/searcher/glue.rs
index 14d09feb..21a58aa4 100644
--- a/crates/searcher/src/searcher/glue.rs
+++ b/crates/searcher/src/searcher/glue.rs
@@ -10,7 +10,7 @@ use crate::searcher::core::Core;
use crate::searcher::{Config, Range, Searcher};
#[derive(Debug)]
-pub struct ReadByLine<'s, M: 's, R, S> {
+pub struct ReadByLine<'s, M, R, S> {
config: &'s Config,
core: Core<'s, M, S>,
rdr: LineBufferReader<'s, R>,
@@ -87,7 +87,7 @@ where
}
#[derive(Debug)]
-pub struct SliceByLine<'s, M: 's, S> {
+pub struct SliceByLine<'s, M, S> {
config: &'s Config,
core: Core<'s, M, S>,
slice: &'s [u8],
@@ -134,7 +134,7 @@ impl<'s, M: Matcher, S: Sink> SliceByLine<'s, M, S> {
}
#[derive(Debug)]
-pub struct MultiLine<'s, M: 's, S> {
+pub struct MultiLine<'s, M, S> {
config: &'s Config,
core: Core<'s, M, S>,
slice: &'s [u8],
diff --git a/crates/searcher/src/searcher/mod.rs b/crates/searcher/src/searcher/mod.rs
index 917fa374..5f9cc760 100644
--- a/crates/searcher/src/searcher/mod.rs
+++ b/crates/searcher/src/searcher/mod.rs
@@ -263,7 +263,7 @@ impl ::std::error::Error for ConfigError {
}
impl fmt::Display for ConfigError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ConfigError::SearchUnavailable => {
write!(f, "grep config error: no available searchers")
diff --git a/crates/searcher/src/sink.rs b/crates/searcher/src/sink.rs
index bcbad578..41f425cc 100644
--- a/crates/searcher/src/sink.rs
+++ b/crates/searcher/src/sink.rs
@@ -121,7 +121,7 @@ pub trait Sink {
fn matched(
&mut self,
_searcher: &Searcher,
- _mat: &SinkMatch,
+ _mat: &SinkMatch<'_>,
) -> Result<bool, Self::Error>;
/// This method is called whenever a context line is found, and is optional
@@ -140,7 +140,7 @@ pub trait Sink {
fn context(
&mut self,
_searcher: &Searcher,
- _context: &SinkContext,
+ _context: &SinkContext<'_>,
) -> Result<bool, Self::Error> {
Ok(true)
}
@@ -226,7 +226,7 @@ impl<'a, S: Sink> Sink for &'a mut S {
fn matched(
&mut self,
searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, S::Error> {
(**self).matched(searcher, mat)
}
@@ -235,7 +235,7 @@ impl<'a, S: Sink> Sink for &'a mut S {
fn context(
&mut self,
searcher: &Searcher,
- context: &SinkContext,
+ context: &SinkContext<'_>,
) -> Result<bool, S::Error> {
(**self).context(searcher, context)
}
@@ -279,7 +279,7 @@ impl<S: Sink + ?Sized> Sink for Box<S> {
fn matched(
&mut self,
searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, S::Error> {
(**self).matched(searcher, mat)
}
@@ -288,7 +288,7 @@ impl<S: Sink + ?Sized> Sink for Box<S> {
fn context(
&mut self,
searcher: &Searcher,
- context: &SinkContext,
+ context: &SinkContext<'_>,
) -> Result<bool, S::Error> {
(**self).context(searcher, context)
}
@@ -545,7 +545,7 @@ pub mod sinks {
fn matched(
&mut self,
_searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, io::Error> {
let matched = match str::from_utf8(mat.bytes()) {
Ok(matched) => matched,
@@ -593,7 +593,7 @@ pub mod sinks {
fn matched(
&mut self,
_searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, io::Error> {
use std::borrow::Cow;
@@ -643,7 +643,7 @@ pub mod sinks {
fn matched(
&mut self,
_searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, io::Error> {
let line_number = match mat.line_number() {
Some(line_number) => line_number,
diff --git a/crates/searcher/src/testutil.rs b/crates/searcher/src/testutil.rs
index 62dc0db2..659f9cd4 100644
--- a/crates/searcher/src/testutil.rs
+++ b/crates/searcher/src/testutil.rs
@@ -129,7 +129,7 @@ impl Sink for KitchenSink {
fn matched(
&mut self,
_searcher: &Searcher,
- mat: &SinkMatch,
+ mat: &SinkMatch<'_>,
) -> Result<bool, io::Error> {
assert!(!mat.bytes().is_empty());
assert!(mat.lines().count() >= 1);
@@ -152,7 +152,7 @@ impl Sink for KitchenSink {
fn context(
&mut self,
_searcher: &Searcher,
- context: &SinkContext,
+ context: &SinkContext<'_>,
) -> Result<bool, io::Error> {
assert!(!context.bytes().is_empty());
assert!(context.lines().count() == 1);