diff --git a/.github/actions/artifact_failure/action.yml b/.github/actions/artifact_failure/action.yml index 071fe0917..cf77bee2a 100644 --- a/.github/actions/artifact_failure/action.yml +++ b/.github/actions/artifact_failure/action.yml @@ -23,7 +23,7 @@ runs: --exclude='bins' \ --exclude='.git' \ -zcf target/failure-${{ inputs.name }}.tar.gz . - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ inputs.name }} path: target/failure-${{ inputs.name }}.tar.gz diff --git a/src/bin/sccache-dist/build.rs b/src/bin/sccache-dist/build.rs index 33f9f6d3c..3f8088be4 100644 --- a/src/bin/sccache-dist/build.rs +++ b/src/bin/sccache-dist/build.rs @@ -511,7 +511,7 @@ impl DockerBuilder { .context("Unable to list all Docker containers")?; if !containers.is_empty() { let mut containers_to_rm = vec![]; - for line in containers.split(|c| c == '\n') { + for line in containers.split('\n') { let mut iter = line.splitn(2, ' '); let container_id = iter .next() @@ -541,7 +541,7 @@ impl DockerBuilder { .context("Failed to list all docker images")?; if !images.is_empty() { let mut images_to_rm = vec![]; - for line in images.split(|c| c == '\n') { + for line in images.split('\n') { let mut iter = line.splitn(2, ' '); let image_id = iter .next() @@ -609,7 +609,7 @@ impl DockerBuilder { let diff = docker_diff(cid)?; if !diff.is_empty() { let mut lastpath = None; - for line in diff.split(|c| c == '\n') { + for line in diff.split('\n') { let mut iter = line.splitn(2, ' '); let changetype = iter .next() diff --git a/src/bin/sccache-dist/main.rs b/src/bin/sccache-dist/main.rs index 89e28e4bb..28c4a1dc8 100644 --- a/src/bin/sccache-dist/main.rs +++ b/src/bin/sccache-dist/main.rs @@ -85,7 +85,7 @@ fn create_server_token(server_id: ServerId, auth_token: &str) -> String { format!("{} {}", server_id.addr(), auth_token) } fn check_server_token(server_token: &str, auth_token: &str) -> Option { - let mut split = server_token.splitn(2, |c| c == ' '); + let mut split = server_token.splitn(2, ' '); let server_addr = split.next().and_then(|addr| addr.parse().ok())?; match split.next() { Some(t) if t == auth_token => Some(ServerId::new(server_addr)), diff --git a/src/compiler/args.rs b/src/compiler/args.rs index 64d7eb98a..739a026ae 100644 --- a/src/compiler/args.rs +++ b/src/compiler/args.rs @@ -167,7 +167,7 @@ pub struct Iter<'a, T> { emitted: usize, } -impl<'a, T: ArgumentValue> Iterator for Iter<'a, T> { +impl Iterator for Iter<'_, T> { type Item = OsString; fn next(&mut self) -> Option { @@ -218,7 +218,7 @@ pub struct IterStrings<'a, T, F> { } #[cfg(feature = "dist-client")] -impl<'a, T: ArgumentValue, F: FnMut(&Path) -> Option> Iterator for IterStrings<'a, T, F> { +impl Option> Iterator for IterStrings<'_, T, F> { type Item = ArgToStringResult; fn next(&mut self) -> Option { diff --git a/src/compiler/c.rs b/src/compiler/c.rs index 726e91b88..9207e8d1a 100644 --- a/src/compiler/c.rs +++ b/src/compiler/c.rs @@ -286,7 +286,7 @@ where .ok() .map(|f| { f.flatten() - .filter(|f| f.path().extension().map_or(false, |ext| ext == "bc")) + .filter(|f| f.path().extension().is_some_and(|ext| ext == "bc")) .map(|f| f.path()) .collect() }) @@ -1263,7 +1263,7 @@ impl pkg::InputsPackager for CInputsPackager { if !super::CAN_DIST_DYLIBS && input_path .extension() - .map_or(false, |ext| ext == std::env::consts::DLL_EXTENSION) + .is_some_and(|ext| ext == std::env::consts::DLL_EXTENSION) { bail!( "Cannot distribute dylib input {} on this platform", diff --git a/src/compiler/diab.rs b/src/compiler/diab.rs index 60291b87f..6f16c526d 100644 --- a/src/compiler/diab.rs +++ b/src/compiler/diab.rs @@ -399,7 +399,7 @@ impl<'a> ExpandAtArgs<'a> { } } -impl<'a> Iterator for ExpandAtArgs<'a> { +impl Iterator for ExpandAtArgs<'_> { type Item = OsString; fn next(&mut self) -> Option { diff --git a/src/compiler/gcc.rs b/src/compiler/gcc.rs index 9f43ea255..aefd7cd54 100644 --- a/src/compiler/gcc.rs +++ b/src/compiler/gcc.rs @@ -969,15 +969,12 @@ impl<'a> ExpandIncludeFile<'a> { } } -impl<'a> Iterator for ExpandIncludeFile<'a> { +impl Iterator for ExpandIncludeFile<'_> { type Item = OsString; fn next(&mut self) -> Option { loop { - let arg = match self.stack.pop() { - Some(arg) => arg, - None => return None, - }; + let arg = self.stack.pop()?; let file = match arg.split_prefix("@") { Some(arg) => self.cwd.join(arg), None => return Some(arg), diff --git a/src/compiler/msvc.rs b/src/compiler/msvc.rs index 19eae82a1..fcfe66bdb 100644 --- a/src/compiler/msvc.rs +++ b/src/compiler/msvc.rs @@ -1184,7 +1184,7 @@ impl<'a> ExpandIncludeFile<'a> { } } -impl<'a> Iterator for ExpandIncludeFile<'a> { +impl Iterator for ExpandIncludeFile<'_> { type Item = OsString; fn next(&mut self) -> Option { @@ -1197,10 +1197,7 @@ impl<'a> Iterator for ExpandIncludeFile<'a> { } // Visit the next argument provided by the original command iterator. - let arg = match self.args.pop() { - Some(arg) => arg, - None => return None, - }; + let arg = self.args.pop()?; let file_arg = match arg.split_prefix("@") { Some(file_arg) => file_arg, None => return Some(arg), @@ -1290,7 +1287,7 @@ where } } -impl<'a> SplitMsvcResponseFileArgs<'a> { +impl SplitMsvcResponseFileArgs<'_> { /// Appends backslashes to `target` by decrementing `count`. /// If `step` is >1, then `count` is decremented by `step`, resulting in 1 backslash appended for every `step`. fn append_backslashes_to(target: &mut String, count: &mut usize, step: usize) { @@ -1301,7 +1298,7 @@ impl<'a> SplitMsvcResponseFileArgs<'a> { } } -impl<'a> Iterator for SplitMsvcResponseFileArgs<'a> { +impl Iterator for SplitMsvcResponseFileArgs<'_> { type Item = String; fn next(&mut self) -> Option { diff --git a/src/config.rs b/src/config.rs index 68dfe3cd4..4dce460e4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -579,7 +579,7 @@ pub fn try_read_config_file(path: &Path) -> Result Option<&str> { let header = request.header("Authorization")?; - let mut split = header.splitn(2, |c| c == ' '); + let mut split = header.splitn(2, ' '); let authtype = split.next()?; if authtype != "Bearer" { diff --git a/src/dist/mod.rs b/src/dist/mod.rs index a55b7c1e3..0aca86232 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -621,14 +621,14 @@ pub struct BuildResult { // structs pub struct ToolchainReader<'a>(Box); -impl<'a> Read for ToolchainReader<'a> { +impl Read for ToolchainReader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } } pub struct InputsReader<'a>(Box); -impl<'a> Read for InputsReader<'a> { +impl Read for InputsReader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } diff --git a/src/lru_disk_cache/lru_cache.rs b/src/lru_disk_cache/lru_cache.rs index f4bf3d8f2..031530d4e 100644 --- a/src/lru_disk_cache/lru_cache.rs +++ b/src/lru_disk_cache/lru_cache.rs @@ -643,7 +643,7 @@ impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> { } } -impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> { +impl ExactSizeIterator for Iter<'_, K, V> { fn len(&self) -> usize { self.0.len() } @@ -671,7 +671,7 @@ impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> { } } -impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> { +impl ExactSizeIterator for IterMut<'_, K, V> { fn len(&self) -> usize { self.0.len() } diff --git a/src/util.rs b/src/util.rs index 7174681d6..fd928732e 100644 --- a/src/util.rs +++ b/src/util.rs @@ -829,7 +829,7 @@ pub struct HashToDigest<'a> { pub digest: &'a mut Digest, } -impl<'a> Hasher for HashToDigest<'a> { +impl Hasher for HashToDigest<'_> { fn write(&mut self, bytes: &[u8]) { self.digest.update(bytes) } diff --git a/tests/harness/mod.rs b/tests/harness/mod.rs index c1c209dc0..6504ea308 100644 --- a/tests/harness/mod.rs +++ b/tests/harness/mod.rs @@ -69,7 +69,7 @@ pub fn stop_local_daemon() -> bool { .stdout(Stdio::null()) .stderr(Stdio::null()) .status() - .map_or(false, |status| status.success()) + .is_ok_and(|status| status.success()) } pub fn get_stats(f: F) { diff --git a/tests/helpers/mod.rs b/tests/helpers/mod.rs index 3fc36bf10..a9cbc6cf1 100644 --- a/tests/helpers/mod.rs +++ b/tests/helpers/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use anyhow::{Context, Result}; use assert_cmd::assert::OutputAssertExt; use chrono::Local;