Clippy fixes for new Rust version (#3392)

This commit is contained in:
JT
2021-05-07 07:58:21 +12:00
committed by GitHub
parent 0f8e31af06
commit 91a929b2a9
19 changed files with 109 additions and 158 deletions

View File

@ -68,18 +68,16 @@ pub fn chop() {
let stdin = io::stdin();
let mut stdout = io::stdout();
for line in stdin.lock().lines() {
if let Ok(given) = line {
let chopped = if given.is_empty() {
&given
} else {
let to = given.len() - 1;
&given[..to]
};
for given in stdin.lock().lines().flatten() {
let chopped = if given.is_empty() {
&given
} else {
let to = given.len() - 1;
&given[..to]
};
if let Err(_e) = writeln!(stdout, "{}", chopped) {
break;
}
if let Err(_e) = writeln!(stdout, "{}", chopped) {
break;
}
}