diff --git a/apps/sl/src/cli.rs b/apps/sl/src/cli.rs index 93eb9d0c..fed632a6 100644 --- a/apps/sl/src/cli.rs +++ b/apps/sl/src/cli.rs @@ -1,4 +1,4 @@ -use clap::{command, Parser}; +use clap::Parser; /// sl cures your bad habit of mistyping. #[derive(Parser, Debug)] diff --git a/apps/sl/src/main.rs b/apps/sl/src/main.rs index 2838435a..5dab3151 100644 --- a/apps/sl/src/main.rs +++ b/apps/sl/src/main.rs @@ -47,11 +47,8 @@ fn main() -> Result<(), Error> { let mut x = screen.columns - 1; loop { - match names_receiver.try_recv() { - Ok(name) => { - names.push(name); - } - Err(_) => {} + if let Ok(name) = names_receiver.try_recv() { + names.push(name); } let mut renderer = TerminalRenderer { @@ -110,9 +107,10 @@ fn cars_receiver(args: &CliOptions, stdin: Stdin) -> Result, Er let stdin_file = FileDescriptor::dup(&stdin.lock())?; std::thread::spawn(move || { let reader = BufReader::new(stdin_file); - reader.lines().for_each(|line| match line { - Ok(line) => sender.send(line).unwrap(), - Err(_) => {} + reader.lines().for_each(|line| { + if let Ok(line) = line { + sender.send(line).unwrap() + } }); }); } else if args.files { diff --git a/libraries/libsl/src/mvaddstr.rs b/libraries/libsl/src/mvaddstr.rs index 95a82cd5..7c8717f6 100644 --- a/libraries/libsl/src/mvaddstr.rs +++ b/libraries/libsl/src/mvaddstr.rs @@ -33,7 +33,7 @@ pub fn mvaddstr( let c_width = c.width() as i32; x += c_width; line = &line[c.len()..]; - if !(x < 0) { + if x >= 0 { break; } } diff --git a/libraries/libsl/src/print_car.rs b/libraries/libsl/src/print_car.rs index b4c70a96..e35872c5 100644 --- a/libraries/libsl/src/print_car.rs +++ b/libraries/libsl/src/print_car.rs @@ -39,7 +39,7 @@ pub fn print_car(buffer: &mut [u8], format: &str, text: &str, text_display_width buffer[end_pos] = 0; } -fn car_text<'a>(buffer_len: usize, text_display_width: usize, text: &'a str) -> &'a str { +fn car_text(buffer_len: usize, text_display_width: usize, text: &str) -> &str { let mut working_text = text; // We need to remove clusters until we will fit in the buffer