Skip to content

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/uu/cp/src/copydir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn get_local_to_root_parent(
8282
/// Given an iterator, return all its items except the last.
8383
fn skip_last<T>(mut iter: impl Iterator<Item = T>) -> impl Iterator<Item = T> {
8484
let last = iter.next();
85-
iter.scan(last, |state, item| std::mem::replace(state, Some(item)))
85+
iter.scan(last, |state, item| state.replace(item))
8686
}
8787

8888
/// Paths that are invariant throughout the traversal when copying a directory.

src/uu/fmt/src/linebreak.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ fn break_knuth_plass<'a, T: Clone + Iterator<Item = &'a WordInfo<'a>>>(
164164

165165
// We find identical breakpoints here by comparing addresses of the references.
166166
// This is OK because the backing vector is not mutating once we are linebreaking.
167-
let winfo_ptr = winfo as *const _;
168-
let next_break_ptr = next_break as *const _;
169-
if winfo_ptr == next_break_ptr {
167+
if std::ptr::eq(winfo, next_break) {
170168
// OK, we found the matching word
171169
if break_before {
172170
write_newline(args.indent_str, args.ostream)?;

src/uu/unexpand/src/unexpand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn tabstops_parse(s: &str) -> Result<Vec<usize>, ParseError> {
5555
}
5656
}
5757

58-
if nums.iter().any(|&n| n == 0) {
58+
if nums.contains(&0) {
5959
return Err(ParseError::TabSizeCannotBeZero);
6060
}
6161

0 commit comments

Comments
 (0)