mirror of
https://github.com/FliegendeWurst/ripgrep-all.git
synced 2024-11-24 12:24:56 +00:00
cargo fmt
This commit is contained in:
parent
ee034f695c
commit
fff5b39470
@ -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!(
|
||||||
|
@ -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.
|
||||||
|
@ -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;
|
||||||
@ -29,7 +29,7 @@ fn meh(float: f32, precision: usize) -> usize {
|
|||||||
let a = float.abs();
|
let a = float.abs();
|
||||||
|
|
||||||
// if abs value is greater than 1, then precision becomes less than "standard"
|
// if abs value is greater than 1, then precision becomes less than "standard"
|
||||||
|
|
||||||
if a >= 1. {
|
if a >= 1. {
|
||||||
// reduce by number of digits, minimum 0
|
// reduce by number of digits, minimum 0
|
||||||
let n = (1. + a.log10().floor()) as usize;
|
let n = (1. + a.log10().floor()) as usize;
|
||||||
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user