mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #3802 from sylvestre/clippy5
Fix some clippy warnings
This commit is contained in:
commit
a27e011259
4 changed files with 9 additions and 8 deletions
|
@ -61,8 +61,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
|
let lines = stdin.lock().lines();
|
||||||
for line in stdin.lock().lines() {
|
for line in lines {
|
||||||
for number in line.unwrap().split_whitespace() {
|
for number in line.unwrap().split_whitespace() {
|
||||||
if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
|
if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
|
||||||
show_warning!("{}: {}", number.maybe_quote(), e);
|
show_warning!("{}: {}", number.maybe_quote(), e);
|
||||||
|
|
|
@ -431,9 +431,9 @@ pub fn dry_exec(tmpdir: &str, prefix: &str, rand: usize, suffix: &str) -> UResul
|
||||||
rand::thread_rng().fill(bytes);
|
rand::thread_rng().fill(bytes);
|
||||||
for byte in bytes.iter_mut() {
|
for byte in bytes.iter_mut() {
|
||||||
*byte = match *byte % 62 {
|
*byte = match *byte % 62 {
|
||||||
v @ 0..=9 => (v + b'0'),
|
v @ 0..=9 => v + b'0',
|
||||||
v @ 10..=35 => (v - 10 + b'a'),
|
v @ 10..=35 => v - 10 + b'a',
|
||||||
v @ 36..=61 => (v - 36 + b'A'),
|
v @ 36..=61 => v - 36 + b'A',
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,8 +429,8 @@ fn prompt(msg: &str) -> bool {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
let mut stdin = stdin.lock();
|
let mut stdin = stdin.lock();
|
||||||
|
let read = stdin.read_until(b'\n', &mut buf);
|
||||||
match stdin.read_until(b'\n', &mut buf) {
|
match read {
|
||||||
Ok(x) if x > 0 => matches!(buf[0], b'y' | b'Y'),
|
Ok(x) if x > 0 => matches!(buf[0], b'y' | b'Y'),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,8 @@ fn word_count_from_input(input: &Input, settings: &Settings) -> CountResult {
|
||||||
Input::Stdin(_) => {
|
Input::Stdin(_) => {
|
||||||
let stdin = io::stdin();
|
let stdin = io::stdin();
|
||||||
let stdin_lock = stdin.lock();
|
let stdin_lock = stdin.lock();
|
||||||
match word_count_from_reader(stdin_lock, settings) {
|
let count = word_count_from_reader(stdin_lock, settings);
|
||||||
|
match count {
|
||||||
(total, Some(error)) => CountResult::Interrupted(total, error),
|
(total, Some(error)) => CountResult::Interrupted(total, error),
|
||||||
(total, None) => CountResult::Success(total),
|
(total, None) => CountResult::Success(total),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue