printer: clean-up

Like a previous commit did for the grep-cli crate, this does some
polishing to the grep-printer crate. We aren't able to achieve as much
as we did with grep-cli, but we at least eliminate all rust-analyzer
lints and group imports in the way I've been doing recently.

Next we'll start doing some more invasive changes.
This commit is contained in:
Andrew Gallant
2023-09-21 16:57:02 -04:00
parent 25a7145c79
commit 09905560ff
13 changed files with 291 additions and 258 deletions

View File

@@ -1,17 +1,20 @@
use std::io::{self, Write};
use std::path::Path;
use std::time::Instant;
use grep_matcher::{Match, Matcher};
use grep_searcher::{
Searcher, Sink, SinkContext, SinkContextKind, SinkFinish, SinkMatch,
use std::{
io::{self, Write},
path::Path,
time::Instant,
};
use serde_json as json;
use crate::counter::CounterWriter;
use crate::jsont;
use crate::stats::Stats;
use crate::util::find_iter_at_in_context;
use {
grep_matcher::{Match, Matcher},
grep_searcher::{
Searcher, Sink, SinkContext, SinkContextKind, SinkFinish, SinkMatch,
},
serde_json as json,
};
use crate::{
counter::CounterWriter, jsont, stats::Stats, util::find_iter_at_in_context,
};
/// The configuration for the JSON printer.
///
@@ -467,7 +470,7 @@ impl<W: io::Write> JSON<W> {
matcher: M,
) -> JSONSink<'static, 's, M, W> {
JSONSink {
matcher: matcher,
matcher,
json: self,
path: None,
start_time: Instant::now(),
@@ -493,7 +496,7 @@ impl<W: io::Write> JSON<W> {
P: ?Sized + AsRef<Path>,
{
JSONSink {
matcher: matcher,
matcher,
json: self,
path: Some(path.as_ref()),
start_time: Instant::now(),