From 9aa5152e3398a62f9bb69ea5aa3d579ebb5d87fc Mon Sep 17 00:00:00 2001 From: Krzysztof Juszczyk Date: Fri, 1 Mar 2024 12:01:33 +0100 Subject: [PATCH] [#55213] Apply cargo formater --- src/cli.rs | 16 +++++----------- src/internals.rs | 6 +++++- src/shell_base.rs | 14 +++----------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 728759c..fba4293 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -49,7 +49,6 @@ impl Cli { if !self.insert_mode { self.insert_mode = true; } - } fn echo(&self, output: &str) { @@ -140,13 +139,12 @@ impl Perform for Cli { self.cursor_position = 0; self.input_ready = true; } - _ => {/* ignore for now */} + _ => { /* ignore for now */ } } io::stdout().flush().unwrap(); } fn hook(&mut self, _params: &Params, _intermediates: &[u8], _ignore: bool, _c: char) { - /* ignore for now */ } @@ -177,8 +175,7 @@ impl Perform for Cli { } self.erase_input(); - self.input = - self.history[self.history_entry_to_display as usize].clone(); + self.input = self.history[self.history_entry_to_display as usize].clone(); self.cursor_position = self.input.len(); self.echo(&self.input.iter().collect::()); } @@ -187,8 +184,7 @@ impl Perform for Cli { (_, 'B') => { if self.history_entry_to_display != -1 { self.erase_input(); - if self.history.len() - 1 > (self.history_entry_to_display as usize) - { + if self.history.len() - 1 > (self.history_entry_to_display as usize) { self.history_entry_to_display += 1; self.input = self.history[self.history_entry_to_display as usize].clone(); @@ -258,9 +254,7 @@ impl Perform for Cli { self.echo(&self.input.iter().collect::()); } } - (_, _) => { - /* ignore for now */ - } + (_, _) => { /* ignore for now */ } } } else { /* ignore for now */ @@ -271,4 +265,4 @@ impl Perform for Cli { fn esc_dispatch(&mut self, _intermediates: &[u8], _ignore: bool, _byte: u8) { /* ignore for now */ } -} \ No newline at end of file +} diff --git a/src/internals.rs b/src/internals.rs index 20a0f41..d891c3f 100644 --- a/src/internals.rs +++ b/src/internals.rs @@ -110,7 +110,11 @@ fn history( output_device: &mut OutputDevice, ) -> Result { for (i, history_entry) in shell.cli.history.iter().enumerate() { - output_device.println(&format!("{}: {}", i + 1, history_entry.iter().collect::())); + output_device.println(&format!( + "{}: {}", + i + 1, + history_entry.iter().collect::() + )); } Ok(EXIT_SUCCESS) } diff --git a/src/shell_base.rs b/src/shell_base.rs index a380e9a..5793be5 100644 --- a/src/shell_base.rs +++ b/src/shell_base.rs @@ -589,18 +589,12 @@ impl Shell { while !self.cli.is_input_ready() { match self.reader.read_byte()? { - Some(byte) => { - vt_parser.advance(&mut self.cli, byte) - }, + Some(byte) => vt_parser.advance(&mut self.cli, byte), None => return Ok(false), } } - *input = self.cli.input - .iter() - .collect::() - .trim() - .to_string(); + *input = self.cli.input.iter().collect::().trim().to_string(); Ok(true) } @@ -683,9 +677,7 @@ impl Shell { self.cli.history = fs::read_to_string(&self.history_path) .unwrap() .lines() - .map(|line| { - line.chars().collect::>() - }) + .map(|line| line.chars().collect::>()) .collect::>>(); }