Skip to content

Commit edcad82

Browse files
stty: run rustfmt and remove extra comments
1 parent f96b0ee commit edcad82

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/uu/stty/src/stty.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
mod flags;
99

1010
use clap::{Arg, ArgAction, ArgMatches, Command};
11-
use nix::libc::{c_ushort, O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ};
11+
use nix::libc::{O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ, c_ushort};
1212
use nix::sys::termios::{
13-
cfgetospeed, cfsetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags,
14-
OutputFlags, SpecialCharacterIndices, Termios,
13+
ControlFlags, InputFlags, LocalFlags, OutputFlags, SpecialCharacterIndices, Termios,
14+
cfgetospeed, cfsetospeed, tcgetattr, tcsetattr,
1515
};
1616
use nix::{ioctl_read_bad, ioctl_write_ptr_bad};
1717
use std::fs::File;
18-
use std::io::{self, stdout, Stdout};
18+
use std::io::{self, Stdout, stdout};
1919
use std::ops::ControlFlow;
2020
use std::os::fd::{AsFd, BorrowedFd};
2121
use std::os::unix::fs::OpenOptionsExt;
@@ -224,7 +224,9 @@ fn stty(opts: &Options) -> UResult<()> {
224224
ControlCharMappingError::IntOutOfRange => {
225225
return Err(USimpleError::new(
226226
1,
227-
format!("invalid integer argument: '{new_cc}': Numerical result out of range"),
227+
format!(
228+
"invalid integer argument: '{new_cc}': Numerical result out of range"
229+
),
228230
));
229231
}
230232
ControlCharMappingError::MultipleChars => {
@@ -530,7 +532,6 @@ fn string_to_control_char(s: &str) -> Result<u8, ControlCharMappingError> {
530532
return Ok(0);
531533
}
532534

533-
// check if the number is greater than 255, return ControlCharMappingError::IntOutOfRange
534535
// try to parse integer (hex, octal, or decimal)
535536
let mut ascii_num: Option<u32> = None;
536537
if let Some(hex) = s.strip_prefix("0x") {
@@ -556,7 +557,7 @@ fn string_to_control_char(s: &str) -> Result<u8, ControlCharMappingError> {
556557
if c == '?' {
557558
return Ok(ASCII_DEL);
558559
}
559-
// subract by '@' to turn the char into the ascii value of '^<char>'
560+
// subtract by '@' to turn the char into the ascii value of '^<char>'
560561
Ok((c.to_ascii_uppercase() as u8).wrapping_sub(b'@'))
561562
}
562563
(Some(c), None) => Ok(c as u8),

0 commit comments

Comments
 (0)