clippy: fix warnings introduced by Rust 1.75

This commit is contained in:
Daniel Hofstetter 2023-12-28 17:44:23 +01:00
parent 76fedf60ce
commit 9bb725cefc
5 changed files with 7 additions and 6 deletions

View file

@ -196,7 +196,7 @@ mod tests {
.collect();
let patterns = get_patterns(input.as_slice()).unwrap();
assert_eq!(patterns.len(), 3);
match patterns.get(0) {
match patterns.first() {
Some(Pattern::UpToLine(24, ExecutePattern::Times(1))) => (),
_ => panic!("expected UpToLine pattern"),
};
@ -227,7 +227,7 @@ mod tests {
.collect();
let patterns = get_patterns(input.as_slice()).unwrap();
assert_eq!(patterns.len(), 5);
match patterns.get(0) {
match patterns.first() {
Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(1))) => {
let parsed_reg = format!("{reg}");
assert_eq!(parsed_reg, "test1.*end$");
@ -281,7 +281,7 @@ mod tests {
.collect();
let patterns = get_patterns(input.as_slice()).unwrap();
assert_eq!(patterns.len(), 5);
match patterns.get(0) {
match patterns.first() {
Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(1))) => {
let parsed_reg = format!("{reg}");
assert_eq!(parsed_reg, "test1.*end$");

View file

@ -3,6 +3,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
#![allow(clippy::items_after_test_module)]
use smallvec::SmallVec;
use std::cell::RefCell;
use std::fmt;

View file

@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
table();
Ok(())
}
Mode::List => list(pids_or_signals.get(0)),
Mode::List => list(pids_or_signals.first()),
}
}

View file

@ -4139,7 +4139,7 @@ fn test_ls_hyperlink_dirs() {
assert!(result
.stdout_str()
.lines()
.nth(0)
.next()
.unwrap()
.contains(&format!("{path}{separator}{dir_a}\x07{dir_a}\x1b]8;;\x07:")));
assert_eq!(result.stdout_str().lines().nth(1).unwrap(), "");

View file

@ -696,7 +696,7 @@ fn test_file_owned_by_egid() {
if user_gid != file_gid {
let file_uid = metadata.uid();
let path = CString::new(at.plus("regular_file").as_os_str().as_bytes()).expect("bad path");
let r = unsafe { libc::chown(path.as_ptr().into(), file_uid, user_gid) };
let r = unsafe { libc::chown(path.as_ptr(), file_uid, user_gid) };
assert_ne!(r, -1);
}