edition: run 'cargo fix --edition --edition-idioms --all'

This commit is contained in:
Andrew Gallant
2021-06-01 19:47:46 -04:00
parent 77a9e99964
commit af54069c51
36 changed files with 107 additions and 137 deletions

View File

@@ -1,6 +1,3 @@
extern crate grep_regex;
extern crate grep_searcher;
use std::env;
use std::error::Error;
use std::io;

View File

@@ -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::{

View File

@@ -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],

View File

@@ -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")

View File

@@ -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,

View File

@@ -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);