mirror of
https://github.com/FliegendeWurst/ripgrep-all.git
synced 2024-11-08 22:10:37 +00:00
rustfmt
This commit is contained in:
parent
6eb090b839
commit
45b7b7ae6f
@ -158,7 +158,10 @@ impl Read for ReadErr {
|
||||
}
|
||||
}*/
|
||||
|
||||
pub fn postproc_encoding<'a, R: Read+'a>(line_prefix: &str, inp: R) -> Result<Box<dyn Read + 'a>> {
|
||||
pub fn postproc_encoding<'a, R: Read + 'a>(
|
||||
line_prefix: &str,
|
||||
inp: R,
|
||||
) -> Result<Box<dyn Read + 'a>> {
|
||||
// TODO: parse these options from ripgrep's configuration
|
||||
let encoding = None; // detect bom but usually assume utf8
|
||||
let bom_sniffing = true;
|
||||
@ -184,9 +187,7 @@ pub fn postproc_encoding<'a, R: Read+'a>(line_prefix: &str, inp: R) -> Result<Bo
|
||||
if fourk.contains(&0u8) {
|
||||
log::debug!("detected binary");
|
||||
let v = "[rga: binary data]";
|
||||
return Ok(Box::new(std::io::Cursor::new(
|
||||
v
|
||||
)));
|
||||
return Ok(Box::new(std::io::Cursor::new(v)));
|
||||
/*let err = std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidData,
|
||||
format!("{}[rga: binary data]", line_prefix),
|
||||
@ -280,7 +281,12 @@ mod tests {
|
||||
|
||||
test_from_strs(false, "foo.pdf:", inp, oup)?;
|
||||
|
||||
test_from_strs(false, "foo:", "this is a test \n\n \0 foo", "foo:[rga: binary data]")?;
|
||||
test_from_strs(
|
||||
false,
|
||||
"foo:",
|
||||
"this is a test \n\n \0 foo",
|
||||
"foo:[rga: binary data]",
|
||||
)?;
|
||||
test_from_strs(false, "foo:", "\0", "foo:[rga: binary data]")?;
|
||||
|
||||
Ok(())
|
||||
|
@ -21,7 +21,9 @@ pub trait PreprocCache: Send + Sync {
|
||||
}
|
||||
|
||||
/// opens a LMDB cache
|
||||
fn open_cache_db(path: &Path) -> Result<std::sync::Arc<std::sync::RwLock<rkv::Rkv<LmdbEnvironment>>>> {
|
||||
fn open_cache_db(
|
||||
path: &Path,
|
||||
) -> Result<std::sync::Arc<std::sync::RwLock<rkv::Rkv<LmdbEnvironment>>>> {
|
||||
std::fs::create_dir_all(path)?;
|
||||
use rkv::backend::LmdbEnvironmentFlags;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user