From 621fa1e4c5869e55f8c19c89d7cb0b9d04decc82 Mon Sep 17 00:00:00 2001 From: LoricAndre Date: Sun, 1 Dec 2024 15:46:02 +0100 Subject: [PATCH] chore: cargo fmt --- skim/src/bin/main.rs | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/skim/src/bin/main.rs b/skim/src/bin/main.rs index 288a8e53..9e8cbb9a 100644 --- a/skim/src/bin/main.rs +++ b/skim/src/bin/main.rs @@ -97,23 +97,22 @@ fn sk_main() -> Result { //------------------------------------------------------------------------------ // output - let Some(result) = ( - if opts.tmux.is_some() { - crate::tmux::run_with(&opts) + let Some(result) = (if opts.tmux.is_some() { + crate::tmux::run_with(&opts) + } else { + // read from pipe or command + let rx_item = if io::stdin().is_terminal() { + None } else { - // read from pipe or command - let rx_item = if io::stdin().is_terminal() { - None - } else { - let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin())); - Some(rx_item) - }; - // filter mode - if opts.filter.is_some() { - return Ok(filter(&bin_options, &opts, rx_item)); - } - Skim::run_with(&opts, rx_item) - }) else { + let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin())); + Some(rx_item) + }; + // filter mode + if opts.filter.is_some() { + return Ok(filter(&bin_options, &opts, rx_item)); + } + Skim::run_with(&opts, rx_item) + }) else { return Ok(135); }; @@ -189,11 +188,7 @@ pub struct BinOptions { print_cmd: bool, } -pub fn filter( - bin_option: &BinOptions, - options: &SkimOptions, - source: Option, -) -> i32 { +pub fn filter(bin_option: &BinOptions, options: &SkimOptions, source: Option) -> i32 { let default_command = match env::var("SKIM_DEFAULT_COMMAND").as_ref().map(String::as_ref) { Ok("") | Err(_) => "find .".to_owned(), Ok(val) => val.to_owned(),