Skip to content

Commit

Permalink
[#55213] Apply cargo formater
Browse files Browse the repository at this point in the history
  • Loading branch information
k-juszczyk committed Mar 1, 2024
1 parent 23b21ef commit 9aa5152
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
16 changes: 5 additions & 11 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ impl Cli {
if !self.insert_mode {
self.insert_mode = true;
}

}

fn echo(&self, output: &str) {
Expand Down Expand Up @@ -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 */
}

Expand Down Expand Up @@ -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::<String>());
}
Expand All @@ -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();
Expand Down Expand Up @@ -258,9 +254,7 @@ impl Perform for Cli {
self.echo(&self.input.iter().collect::<String>());
}
}
(_, _) => {
/* ignore for now */
}
(_, _) => { /* ignore for now */ }
}
} else {
/* ignore for now */
Expand All @@ -271,4 +265,4 @@ impl Perform for Cli {
fn esc_dispatch(&mut self, _intermediates: &[u8], _ignore: bool, _byte: u8) {
/* ignore for now */
}
}
}
6 changes: 5 additions & 1 deletion src/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ fn history(
output_device: &mut OutputDevice,
) -> Result<i32, Report> {
for (i, history_entry) in shell.cli.history.iter().enumerate() {
output_device.println(&format!("{}: {}", i + 1, history_entry.iter().collect::<String>()));
output_device.println(&format!(
"{}: {}",
i + 1,
history_entry.iter().collect::<String>()
));
}
Ok(EXIT_SUCCESS)
}
Expand Down
14 changes: 3 additions & 11 deletions src/shell_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<String>()
.trim()
.to_string();
*input = self.cli.input.iter().collect::<String>().trim().to_string();
Ok(true)
}

Expand Down Expand Up @@ -683,9 +677,7 @@ impl Shell {
self.cli.history = fs::read_to_string(&self.history_path)
.unwrap()
.lines()
.map(|line| {
line.chars().collect::<Vec<char>>()
})
.map(|line| line.chars().collect::<Vec<char>>())
.collect::<Vec<Vec<char>>>();
}

Expand Down

0 comments on commit 9aa5152

Please sign in to comment.