Browse Source

refactoring: fix clippy warnings in interpret function

main
fdai7375 2 years ago
committed by fdai7451
parent
commit
0f7850e473
  1. 6
      src/execute.rs

6
src/execute.rs

@ -10,16 +10,16 @@ use std::{io, thread};
/// This function is not directly in main.rs because it might be called by other function too (eg. /// This function is not directly in main.rs because it might be called by other function too (eg.
/// when piping commands). /// when piping commands).
pub fn interpret(line: String, config: &mut BuiltinConfig, ctrlc_recv: Receiver<()>) { pub fn interpret(line: String, config: &mut BuiltinConfig, ctrlc_recv: Receiver<()>) {
match try_interpret(line, config, ctrlc_recv.clone()) {
match try_interpret(line, config, ctrlc_recv) {
Ok(_) | Err(ShellError::Interrupt) | Err(ShellError::EmptyLine) => (), Ok(_) | Err(ShellError::Interrupt) | Err(ShellError::EmptyLine) => (),
Err(ShellError::NotFound(cmd)) => { Err(ShellError::NotFound(cmd)) => {
eprintln!("{}: command not found", cmd.get_program().to_string_lossy()) eprintln!("{}: command not found", cmd.get_program().to_string_lossy())
} }
Err(ShellError::ExecuteFailure(msg)) => { Err(ShellError::ExecuteFailure(msg)) => {
eprintln!("{}", msg)
eprintln!("{msg}")
} }
Err(ShellError::MalformedArgs(args)) => { Err(ShellError::MalformedArgs(args)) => {
eprintln!("Malformed arguments: {}", args)
eprintln!("Malformed arguments: {args}")
} }
} }
} }

Loading…
Cancel
Save