1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 20:17:45 +00:00

stty: fix clippy warnings

This commit is contained in:
Terts Diepraam 2022-06-27 13:07:35 +02:00 committed by Sylvestre Ledru
parent 0c44fc07d2
commit 96ea772016

View file

@ -40,7 +40,7 @@ where
T: Copy, T: Copy,
{ {
pub const fn new(name: &'static str, flag: T) -> Self { pub const fn new(name: &'static str, flag: T) -> Self {
Flag { Self {
name, name,
flag, flag,
show: true, show: true,
@ -164,14 +164,12 @@ fn print_flags<T: TermiosFlag>(termios: &Termios, opts: &Options, flags: &[Flag<
print!("{name} "); print!("{name} ");
printed = true; printed = true;
} }
} else { } else if opts.all || val != sane {
if opts.all || val != sane { if !val {
if !val { print!("-");
print!("-");
}
print!("{name} ");
printed = true;
} }
print!("{name} ");
printed = true;
} }
} }
if printed { if printed {
@ -256,7 +254,7 @@ impl TermiosFlag for ControlFlags {
} }
fn apply(&self, termios: &mut Termios, val: bool) { 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) { 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) { 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) { fn apply(&self, termios: &mut Termios, val: bool) {
termios.local_flags.set(*self, val) termios.local_flags.set(*self, val);
} }
} }