mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
apply simple clippy nightly suggestions
See also: https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_option_with_some https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
This commit is contained in:
parent
fc3f7eaa48
commit
875770f5d1
3 changed files with 3 additions and 5 deletions
|
@ -82,7 +82,7 @@ fn get_local_to_root_parent(
|
||||||
/// Given an iterator, return all its items except the last.
|
/// Given an iterator, return all its items except the last.
|
||||||
fn skip_last<T>(mut iter: impl Iterator<Item = T>) -> impl Iterator<Item = T> {
|
fn skip_last<T>(mut iter: impl Iterator<Item = T>) -> impl Iterator<Item = T> {
|
||||||
let last = iter.next();
|
let last = iter.next();
|
||||||
iter.scan(last, |state, item| std::mem::replace(state, Some(item)))
|
iter.scan(last, |state, item| state.replace(item))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paths that are invariant throughout the traversal when copying a directory.
|
/// Paths that are invariant throughout the traversal when copying a directory.
|
||||||
|
|
|
@ -164,9 +164,7 @@ fn break_knuth_plass<'a, T: Clone + Iterator<Item = &'a WordInfo<'a>>>(
|
||||||
|
|
||||||
// We find identical breakpoints here by comparing addresses of the references.
|
// We find identical breakpoints here by comparing addresses of the references.
|
||||||
// This is OK because the backing vector is not mutating once we are linebreaking.
|
// This is OK because the backing vector is not mutating once we are linebreaking.
|
||||||
let winfo_ptr = winfo as *const _;
|
if std::ptr::eq(winfo, next_break) {
|
||||||
let next_break_ptr = next_break as *const _;
|
|
||||||
if winfo_ptr == next_break_ptr {
|
|
||||||
// OK, we found the matching word
|
// OK, we found the matching word
|
||||||
if break_before {
|
if break_before {
|
||||||
write_newline(args.indent_str, args.ostream)?;
|
write_newline(args.indent_str, args.ostream)?;
|
||||||
|
|
|
@ -55,7 +55,7 @@ fn tabstops_parse(s: &str) -> Result<Vec<usize>, ParseError> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if nums.iter().any(|&n| n == 0) {
|
if nums.contains(&0) {
|
||||||
return Err(ParseError::TabSizeCannotBeZero);
|
return Err(ParseError::TabSizeCannotBeZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue