Skip to content

Commit d5f83a7

Browse files
authored
Apply clippy fixes and bump ghac from v2 to v4 bump (#2341)
1 parent 4271d46 commit d5f83a7

File tree

15 files changed

+26
-30
lines changed

15 files changed

+26
-30
lines changed

.github/actions/artifact_failure/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ runs:
2323
--exclude='bins' \
2424
--exclude='.git' \
2525
-zcf target/failure-${{ inputs.name }}.tar.gz .
26-
- uses: actions/upload-artifact@v3
26+
- uses: actions/upload-artifact@v4
2727
with:
2828
name: ${{ inputs.name }}
2929
path: target/failure-${{ inputs.name }}.tar.gz

src/bin/sccache-dist/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ impl DockerBuilder {
511511
.context("Unable to list all Docker containers")?;
512512
if !containers.is_empty() {
513513
let mut containers_to_rm = vec![];
514-
for line in containers.split(|c| c == '\n') {
514+
for line in containers.split('\n') {
515515
let mut iter = line.splitn(2, ' ');
516516
let container_id = iter
517517
.next()
@@ -541,7 +541,7 @@ impl DockerBuilder {
541541
.context("Failed to list all docker images")?;
542542
if !images.is_empty() {
543543
let mut images_to_rm = vec![];
544-
for line in images.split(|c| c == '\n') {
544+
for line in images.split('\n') {
545545
let mut iter = line.splitn(2, ' ');
546546
let image_id = iter
547547
.next()
@@ -609,7 +609,7 @@ impl DockerBuilder {
609609
let diff = docker_diff(cid)?;
610610
if !diff.is_empty() {
611611
let mut lastpath = None;
612-
for line in diff.split(|c| c == '\n') {
612+
for line in diff.split('\n') {
613613
let mut iter = line.splitn(2, ' ');
614614
let changetype = iter
615615
.next()

src/bin/sccache-dist/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn create_server_token(server_id: ServerId, auth_token: &str) -> String {
8585
format!("{} {}", server_id.addr(), auth_token)
8686
}
8787
fn check_server_token(server_token: &str, auth_token: &str) -> Option<ServerId> {
88-
let mut split = server_token.splitn(2, |c| c == ' ');
88+
let mut split = server_token.splitn(2, ' ');
8989
let server_addr = split.next().and_then(|addr| addr.parse().ok())?;
9090
match split.next() {
9191
Some(t) if t == auth_token => Some(ServerId::new(server_addr)),

src/compiler/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub struct Iter<'a, T> {
167167
emitted: usize,
168168
}
169169

170-
impl<'a, T: ArgumentValue> Iterator for Iter<'a, T> {
170+
impl<T: ArgumentValue> Iterator for Iter<'_, T> {
171171
type Item = OsString;
172172

173173
fn next(&mut self) -> Option<Self::Item> {
@@ -218,7 +218,7 @@ pub struct IterStrings<'a, T, F> {
218218
}
219219

220220
#[cfg(feature = "dist-client")]
221-
impl<'a, T: ArgumentValue, F: FnMut(&Path) -> Option<String>> Iterator for IterStrings<'a, T, F> {
221+
impl<T: ArgumentValue, F: FnMut(&Path) -> Option<String>> Iterator for IterStrings<'_, T, F> {
222222
type Item = ArgToStringResult;
223223

224224
fn next(&mut self) -> Option<Self::Item> {

src/compiler/c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ where
286286
.ok()
287287
.map(|f| {
288288
f.flatten()
289-
.filter(|f| f.path().extension().map_or(false, |ext| ext == "bc"))
289+
.filter(|f| f.path().extension().is_some_and(|ext| ext == "bc"))
290290
.map(|f| f.path())
291291
.collect()
292292
})
@@ -1263,7 +1263,7 @@ impl pkg::InputsPackager for CInputsPackager {
12631263
if !super::CAN_DIST_DYLIBS
12641264
&& input_path
12651265
.extension()
1266-
.map_or(false, |ext| ext == std::env::consts::DLL_EXTENSION)
1266+
.is_some_and(|ext| ext == std::env::consts::DLL_EXTENSION)
12671267
{
12681268
bail!(
12691269
"Cannot distribute dylib input {} on this platform",

src/compiler/diab.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'a> ExpandAtArgs<'a> {
399399
}
400400
}
401401

402-
impl<'a> Iterator for ExpandAtArgs<'a> {
402+
impl Iterator for ExpandAtArgs<'_> {
403403
type Item = OsString;
404404

405405
fn next(&mut self) -> Option<OsString> {

src/compiler/gcc.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,15 +969,12 @@ impl<'a> ExpandIncludeFile<'a> {
969969
}
970970
}
971971

972-
impl<'a> Iterator for ExpandIncludeFile<'a> {
972+
impl Iterator for ExpandIncludeFile<'_> {
973973
type Item = OsString;
974974

975975
fn next(&mut self) -> Option<OsString> {
976976
loop {
977-
let arg = match self.stack.pop() {
978-
Some(arg) => arg,
979-
None => return None,
980-
};
977+
let arg = self.stack.pop()?;
981978
let file = match arg.split_prefix("@") {
982979
Some(arg) => self.cwd.join(arg),
983980
None => return Some(arg),

src/compiler/msvc.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ impl<'a> ExpandIncludeFile<'a> {
11841184
}
11851185
}
11861186

1187-
impl<'a> Iterator for ExpandIncludeFile<'a> {
1187+
impl Iterator for ExpandIncludeFile<'_> {
11881188
type Item = OsString;
11891189

11901190
fn next(&mut self) -> Option<OsString> {
@@ -1197,10 +1197,7 @@ impl<'a> Iterator for ExpandIncludeFile<'a> {
11971197
}
11981198

11991199
// Visit the next argument provided by the original command iterator.
1200-
let arg = match self.args.pop() {
1201-
Some(arg) => arg,
1202-
None => return None,
1203-
};
1200+
let arg = self.args.pop()?;
12041201
let file_arg = match arg.split_prefix("@") {
12051202
Some(file_arg) => file_arg,
12061203
None => return Some(arg),
@@ -1290,7 +1287,7 @@ where
12901287
}
12911288
}
12921289

1293-
impl<'a> SplitMsvcResponseFileArgs<'a> {
1290+
impl SplitMsvcResponseFileArgs<'_> {
12941291
/// Appends backslashes to `target` by decrementing `count`.
12951292
/// If `step` is >1, then `count` is decremented by `step`, resulting in 1 backslash appended for every `step`.
12961293
fn append_backslashes_to(target: &mut String, count: &mut usize, step: usize) {
@@ -1301,7 +1298,7 @@ impl<'a> SplitMsvcResponseFileArgs<'a> {
13011298
}
13021299
}
13031300

1304-
impl<'a> Iterator for SplitMsvcResponseFileArgs<'a> {
1301+
impl Iterator for SplitMsvcResponseFileArgs<'_> {
13051302
type Item = String;
13061303

13071304
fn next(&mut self) -> Option<String> {

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ pub fn try_read_config_file<T: DeserializeOwned>(path: &Path) -> Result<Option<T
579579
}
580580
}
581581

582-
let res = if path.extension().map_or(false, |e| e == "json") {
582+
let res = if path.extension().is_some_and(|e| e == "json") {
583583
serde_json::from_str(&string)
584584
.with_context(|| format!("Failed to load json config file from {}", path.display()))?
585585
} else {

src/dist/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ mod server {
532532
fn bearer_http_auth(request: &rouille::Request) -> Option<&str> {
533533
let header = request.header("Authorization")?;
534534

535-
let mut split = header.splitn(2, |c| c == ' ');
535+
let mut split = header.splitn(2, ' ');
536536

537537
let authtype = split.next()?;
538538
if authtype != "Bearer" {

0 commit comments

Comments
 (0)