diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index 551ec0374..ba58ecbac 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -82,7 +82,7 @@ fn get_local_to_root_parent( /// Given an iterator, return all its items except the last. fn skip_last(mut iter: impl Iterator) -> impl Iterator { 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. diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index 72f954914..6c34b0808 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -164,9 +164,7 @@ fn break_knuth_plass<'a, T: Clone + Iterator>>( // 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. - let winfo_ptr = winfo as *const _; - let next_break_ptr = next_break as *const _; - if winfo_ptr == next_break_ptr { + if std::ptr::eq(winfo, next_break) { // OK, we found the matching word if break_before { write_newline(args.indent_str, args.ostream)?; diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 7d12daf0c..fb17b971d 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -55,7 +55,7 @@ fn tabstops_parse(s: &str) -> Result, ParseError> { } } - if nums.iter().any(|&n| n == 0) { + if nums.contains(&0) { return Err(ParseError::TabSizeCannotBeZero); }