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()
.context("rga-fzf-open executable is in non-unicode path")?;
let rg_prefix = format!(
"{preproc_exe} --files-with-matches --rga-cache-max-blob-len=10M"
);
let rg_prefix = format!("{preproc_exe} --files-with-matches --rga-cache-max-blob-len=10M");
let child = Command::new("fzf")
.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
// 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");
Some(CaptureRef {
cap,
end: cap_end,
})
Some(CaptureRef { cap, end: cap_end })
}
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,
Ok(cap) => cap,
};
Some(CaptureRef {
cap,
end: i + 1,
})
Some(CaptureRef { cap, end: i + 1 })
}
/// 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;
mod caching_writer;
pub mod config;
pub mod expand;
pub mod matching;
pub mod pipe;
pub mod preproc;
pub mod preproc_cache;
pub mod recurse;
pub mod expand;
#[cfg(test)]
pub mod test_utils;
use anyhow::Context;
@ -29,7 +29,7 @@ fn meh(float: f32, precision: usize) -> usize {
let a = float.abs();
// if abs value is greater than 1, then precision becomes less than "standard"
if a >= 1. {
// reduce by number of digits, minimum 0
let n = (1. + a.log10().floor()) as usize;
@ -57,9 +57,7 @@ pub fn print_dur(start: Instant) -> String {
dur *= 1000.0;
}
let precision = meh(dur, 3);
format!(
"{dur:.precision$}{suffix}s"
)
format!("{dur:.precision$}{suffix}s")
}
pub fn print_bytes(bytes: impl Into<f64>) -> String {