From fff5b39470e289330eb11fac3ceb3de0509fc22e Mon Sep 17 00:00:00 2001 From: phiresky Date: Sun, 25 Dec 2022 19:07:50 +0100 Subject: [PATCH] cargo fmt --- src/bin/rga-fzf.rs | 4 +--- src/expand.rs | 10 ++-------- src/lib.rs | 8 +++----- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/bin/rga-fzf.rs b/src/bin/rga-fzf.rs index 5aa4cd7..9918e2a 100644 --- a/src/bin/rga-fzf.rs +++ b/src/bin/rga-fzf.rs @@ -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!( diff --git a/src/expand.rs b/src/expand.rs index 80a8267..4c7fc44 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -114,10 +114,7 @@ fn find_cap_ref(replacement: &[u8]) -> Option { // 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 { @@ -136,10 +133,7 @@ fn find_cap_ref_braced(rep: &[u8], mut i: usize) -> Option { 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. diff --git a/src/lib.rs b/src/lib.rs index 0faca0a..760dd8b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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) -> String {