From 96ea77201631913665a52e590a9b35813fc55565 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 27 Jun 2022 13:07:35 +0200 Subject: [PATCH] stty: fix clippy warnings --- src/uu/stty/src/stty.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index fa29f761b..fefbf2014 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -40,7 +40,7 @@ where T: Copy, { pub const fn new(name: &'static str, flag: T) -> Self { - Flag { + Self { name, flag, show: true, @@ -164,14 +164,12 @@ fn print_flags(termios: &Termios, opts: &Options, flags: &[Flag< print!("{name} "); printed = true; } - } else { - if opts.all || val != sane { - if !val { - print!("-"); - } - print!("{name} "); - printed = true; + } else if opts.all || val != sane { + if !val { + print!("-"); } + print!("{name} "); + printed = true; } } if printed { @@ -256,7 +254,7 @@ impl TermiosFlag for ControlFlags { } fn apply(&self, termios: &mut Termios, val: bool) { - termios.control_flags.set(*self, val) + termios.control_flags.set(*self, val); } } @@ -267,7 +265,7 @@ impl TermiosFlag for InputFlags { } fn apply(&self, termios: &mut Termios, val: bool) { - termios.input_flags.set(*self, val) + termios.input_flags.set(*self, val); } } @@ -278,7 +276,7 @@ impl TermiosFlag for OutputFlags { } fn apply(&self, termios: &mut Termios, val: bool) { - termios.output_flags.set(*self, val) + termios.output_flags.set(*self, val); } } @@ -289,6 +287,6 @@ impl TermiosFlag for LocalFlags { } fn apply(&self, termios: &mut Termios, val: bool) { - termios.local_flags.set(*self, val) + termios.local_flags.set(*self, val); } }