mirror of
https://github.com/FliegendeWurst/ripgrep-all.git
synced 2024-11-24 12:24:56 +00:00
Run cargo fmt
across repository
This commit is contained in:
parent
78451d9ba0
commit
454e47d2ac
@ -17,13 +17,13 @@ use custom::CustomAdapterConfig;
|
||||
use log::*;
|
||||
use tokio::io::AsyncRead;
|
||||
|
||||
use core::fmt::Debug;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::Iterator;
|
||||
use std::path::PathBuf;
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
use core::fmt::Debug;
|
||||
|
||||
pub type ReadBox = Pin<Box<dyn AsyncRead + Send>>;
|
||||
pub struct AdapterMeta {
|
||||
|
@ -4,19 +4,17 @@
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use async_stream::stream;
|
||||
use bytes::Bytes;
|
||||
use encoding_rs_io::DecodeReaderBytesBuilder;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use async_stream::stream;
|
||||
use tokio_util::io::ReaderStream;
|
||||
use tokio_util::io::StreamReader;
|
||||
use std::cmp::min;
|
||||
use std::io::Cursor;
|
||||
use std::pin::Pin;
|
||||
use std::{
|
||||
cmp::min,
|
||||
};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use tokio_util::io::ReaderStream;
|
||||
use tokio_util::io::StreamReader;
|
||||
|
||||
use crate::adapted_iter::{AdaptedFilesIterBox};
|
||||
use crate::adapted_iter::AdaptedFilesIterBox;
|
||||
|
||||
use super::{AdaptInfo, AdapterMeta, FileAdapter, GetMetadata};
|
||||
|
||||
@ -177,18 +175,30 @@ pub fn postproc_pagebreaks(line_prefix: &str, inp: impl AsyncRead) -> impl Async
|
||||
mod tests {
|
||||
use super::*;
|
||||
use anyhow::Result;
|
||||
use tokio::pin;
|
||||
use std::io::Read;
|
||||
use tokio::pin;
|
||||
|
||||
async fn test_from_strs(pagebreaks: bool, line_prefix: &str, a: &'static str, b: &str) -> Result<()> {
|
||||
async fn test_from_strs(
|
||||
pagebreaks: bool,
|
||||
line_prefix: &str,
|
||||
a: &'static str,
|
||||
b: &str,
|
||||
) -> Result<()> {
|
||||
test_from_bytes(pagebreaks, line_prefix, a.as_bytes(), b).await
|
||||
}
|
||||
|
||||
async fn test_from_bytes(pagebreaks: bool, line_prefix: &str, a: &'static [u8], b: &str) -> Result<()> {
|
||||
async fn test_from_bytes(
|
||||
pagebreaks: bool,
|
||||
line_prefix: &str,
|
||||
a: &'static [u8],
|
||||
b: &str,
|
||||
) -> Result<()> {
|
||||
let mut oup = Vec::new();
|
||||
let inp = postproc_encoding("", a)?;
|
||||
if pagebreaks {
|
||||
postproc_pagebreaks(line_prefix, inp).read_to_end(&mut oup).await?;
|
||||
postproc_pagebreaks(line_prefix, inp)
|
||||
.read_to_end(&mut oup)
|
||||
.await?;
|
||||
} else {
|
||||
let x = postproc_prefix(line_prefix, inp);
|
||||
pin!(x);
|
||||
@ -231,7 +241,8 @@ mod tests {
|
||||
"foo:",
|
||||
"this is a test \n\n \0 foo",
|
||||
"foo:[rga: binary data]",
|
||||
).await?;
|
||||
)
|
||||
.await?;
|
||||
test_from_strs(false, "foo:", "\0", "foo:[rga: binary data]").await?;
|
||||
|
||||
Ok(())
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
use super::*;
|
||||
use anyhow::Result;
|
||||
use async_stream::{stream, AsyncStream};
|
||||
|
@ -5,7 +5,7 @@ use ripgrep_all as rga;
|
||||
|
||||
use anyhow::Context;
|
||||
use log::debug;
|
||||
use std::{time::Instant};
|
||||
use std::time::Instant;
|
||||
use tokio::fs::File;
|
||||
|
||||
#[tokio::main]
|
||||
@ -20,7 +20,9 @@ async fn main() -> anyhow::Result<()> {
|
||||
std::env::current_dir()?.join(&filepath)
|
||||
};
|
||||
|
||||
let i = File::open(&path).await.context("Specified input file not found")?;
|
||||
let i = File::open(&path)
|
||||
.await
|
||||
.context("Specified input file not found")?;
|
||||
let mut o = tokio::io::stdout();
|
||||
let ai = AdaptInfo {
|
||||
inp: Box::pin(i),
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{adapters::custom::CustomAdapterConfig, project_dirs};
|
||||
use anyhow::{Result, Context};
|
||||
use anyhow::{Context, Result};
|
||||
use derive_more::FromStr;
|
||||
use log::*;
|
||||
use schemars::JsonSchema;
|
||||
@ -237,7 +237,7 @@ pub struct CacheConfig {
|
||||
default_value,
|
||||
long = "--rga-cache-path",
|
||||
hidden_short_help = true,
|
||||
require_equals = true,
|
||||
require_equals = true
|
||||
)]
|
||||
pub path: CachePath,
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ use async_compression::tokio::bufread::ZstdDecoder;
|
||||
use async_stream::stream;
|
||||
use log::*;
|
||||
use path_clean::PathClean;
|
||||
use std::sync::Arc;
|
||||
use postproc::PostprocPrefix;
|
||||
use std::convert::TryInto;
|
||||
use std::io::Cursor;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use tokio::io::AsyncBufRead;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
use tokio::io::BufReader;
|
||||
|
@ -3,10 +3,7 @@ use tokio_util::io::{ReaderStream, StreamReader};
|
||||
use crate::{adapted_iter::AdaptedFilesIterBox, adapters::*};
|
||||
use async_stream::stream;
|
||||
|
||||
|
||||
pub fn concat_read_streams(
|
||||
input: AdaptedFilesIterBox,
|
||||
) -> ReadBox {
|
||||
pub fn concat_read_streams(input: AdaptedFilesIterBox) -> ReadBox {
|
||||
let s = stream! {
|
||||
for await output in input {
|
||||
let stream = ReaderStream::new(output.inp);
|
||||
|
Loading…
Reference in New Issue
Block a user