cargo fmt

This commit is contained in:
phiresky 2022-12-25 19:07:50 +01:00
parent ee034f695c
commit fff5b39470
3 changed files with 6 additions and 16 deletions

View File

@ -26,9 +26,7 @@ fn main() -> anyhow::Result<()> {
.to_str() .to_str()
.context("rga-fzf-open executable is in non-unicode path")?; .context("rga-fzf-open executable is in non-unicode path")?;
let rg_prefix = format!( let rg_prefix = format!("{preproc_exe} --files-with-matches --rga-cache-max-blob-len=10M");
"{preproc_exe} --files-with-matches --rga-cache-max-blob-len=10M"
);
let child = Command::new("fzf") let child = Command::new("fzf")
.arg(format!( .arg(format!(

View File

@ -114,10 +114,7 @@ fn find_cap_ref(replacement: &[u8]) -> Option<CaptureRef> {
// therefore be valid UTF-8. If we really cared, we could avoid this UTF-8 // therefore be valid UTF-8. If we really cared, we could avoid this UTF-8
// check with either unsafe or by parsing the number straight from &[u8]. // check with either unsafe or by parsing the number straight from &[u8].
let cap = std::str::from_utf8(&rep[i..cap_end]).expect("valid UTF-8 capture name"); let cap = std::str::from_utf8(&rep[i..cap_end]).expect("valid UTF-8 capture name");
Some(CaptureRef { Some(CaptureRef { cap, end: cap_end })
cap,
end: cap_end,
})
} }
fn find_cap_ref_braced(rep: &[u8], mut i: usize) -> Option<CaptureRef> { fn find_cap_ref_braced(rep: &[u8], mut i: usize) -> Option<CaptureRef> {
@ -136,10 +133,7 @@ fn find_cap_ref_braced(rep: &[u8], mut i: usize) -> Option<CaptureRef> {
Err(_) => return None, Err(_) => return None,
Ok(cap) => cap, Ok(cap) => cap,
}; };
Some(CaptureRef { Some(CaptureRef { cap, end: i + 1 })
cap,
end: i + 1,
})
} }
/// Returns true if and only if the given byte is allowed in a capture name. /// Returns true if and only if the given byte is allowed in a capture name.

View File

@ -4,12 +4,12 @@ pub mod adapted_iter;
pub mod adapters; pub mod adapters;
mod caching_writer; mod caching_writer;
pub mod config; pub mod config;
pub mod expand;
pub mod matching; pub mod matching;
pub mod pipe; pub mod pipe;
pub mod preproc; pub mod preproc;
pub mod preproc_cache; pub mod preproc_cache;
pub mod recurse; pub mod recurse;
pub mod expand;
#[cfg(test)] #[cfg(test)]
pub mod test_utils; pub mod test_utils;
use anyhow::Context; use anyhow::Context;
@ -57,9 +57,7 @@ pub fn print_dur(start: Instant) -> String {
dur *= 1000.0; dur *= 1000.0;
} }
let precision = meh(dur, 3); let precision = meh(dur, 3);
format!( format!("{dur:.precision$}{suffix}s")
"{dur:.precision$}{suffix}s"
)
} }
pub fn print_bytes(bytes: impl Into<f64>) -> String { pub fn print_bytes(bytes: impl Into<f64>) -> String {