Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sl/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{command, Parser};
use clap::Parser;

/// sl cures your bad habit of mistyping.
#[derive(Parser, Debug)]
Expand Down
14 changes: 6 additions & 8 deletions apps/sl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -110,9 +107,10 @@ fn cars_receiver(args: &CliOptions, stdin: Stdin) -> Result<Receiver<String>, 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 {
Expand Down
2 changes: 1 addition & 1 deletion libraries/libsl/src/mvaddstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn mvaddstr<T: RenderTarget>(
let c_width = c.width() as i32;
x += c_width;
line = &line[c.len()..];
if !(x < 0) {
if x >= 0 {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/libsl/src/print_car.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading