From dd19f85d2b3477eb1e5e2bcd6da65540dbef6e1e Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 12 Aug 2022 09:45:16 +0200 Subject: [PATCH] Fix clippy warnings in tests --- tests/by-util/test_pr.rs | 4 ++-- tests/common/util.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index cd832cf68..fdbd19941 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -404,8 +404,8 @@ fn test_with_pr_core_utils_tests() { for test_case in test_cases { let (flags, input_file, expected_file, return_code) = test_case; let mut scenario = new_ucmd!(); - let input_file_path = input_file.get(0).unwrap(); - let test_file_path = expected_file.get(0).unwrap(); + let input_file_path = input_file.first().unwrap(); + let test_file_path = expected_file.first().unwrap(); let value = file_last_modified_time(&scenario, test_file_path); let mut arguments: Vec<&str> = flags .split(' ') diff --git a/tests/common/util.rs b/tests/common/util.rs index b8119ce48..93c7e3d12 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -982,7 +982,7 @@ impl UCommand { tmpd: Rc, env_clear: bool, ) -> Self { - let tmpd_path_buf = String::from(&(*tmpd.as_ref().path().to_str().unwrap())); + let tmpd_path_buf = String::from(tmpd.as_ref().path().to_str().unwrap()); let mut ucmd: Self = Self::new(bin_path, util_name, tmpd_path_buf, env_clear); ucmd.tmpd = Some(tmpd); ucmd @@ -1296,7 +1296,7 @@ pub fn check_coreutil_version( std::str::from_utf8(&version_check.stdout).unwrap() .split('\n') .collect::>() - .get(0) + .first() .map_or_else( || Err(format!("{}: unexpected output format for reference coreutil: '{} --version'", UUTILS_WARNING, util_name)), |s| {