Skip to content

Commit 67e3bf5

Browse files
authored
Merge pull request #3178 from itowlson/clippy-1.88
Clippy 1.88 fixes
2 parents bf339fc + 446f24d commit 67e3bf5

File tree

8 files changed

+23
-29
lines changed

8 files changed

+23
-29
lines changed

build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,15 @@ fn main() {
5151
let default_toolchain = default_toolchain.split(['-', ' ']).next().unwrap();
5252

5353
let toolchain_override = if current_toolchain != default_toolchain {
54-
format!(" +{}", current_toolchain)
54+
format!(" +{current_toolchain}")
5555
} else {
5656
String::new()
5757
};
5858

5959
println!(
6060
r#"
6161
error: the `wasm32-wasip1` target is not installed
62-
= help: consider downloading the target with `rustup{} target add wasm32-wasip1`"#,
63-
toolchain_override
62+
= help: consider downloading the target with `rustup{toolchain_override} target add wasm32-wasip1`"#
6463
);
6564
process::exit(1);
6665
}

src/bin/spin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ fn print_error_chain(err: anyhow::Error) {
8686
eprintln!("\nCaused by:");
8787
for (i, err) in err.chain().skip(1).enumerate() {
8888
if is_multiple {
89-
eprintln!("{i:>4}: {}", err)
89+
eprintln!("{i:>4}: {err}")
9090
} else {
91-
eprintln!(" {}", err)
91+
eprintln!(" {err}")
9292
}
9393
}
9494
}

src/commands/external.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use tokio::process::Command;
1414
const BADGER_GRACE_PERIOD_MILLIS: u64 = 50;
1515

1616
fn override_flag() -> String {
17-
format!("--{}", PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG)
17+
format!("--{PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG}")
1818
}
1919

2020
// Returns true if the argument was removed from the list
@@ -369,7 +369,7 @@ mod test {
369369
)
370370
);
371371

372-
let cmd_with_args_override = format!("example arg1 arg2 {}", override_flag)
372+
let cmd_with_args_override = format!("example arg1 arg2 {override_flag}")
373373
.split(' ')
374374
.map(|s| s.to_string())
375375
.collect::<Vec<String>>();
@@ -382,7 +382,7 @@ mod test {
382382
)
383383
);
384384

385-
let cmd_with_args_override = format!("example {} arg1 arg2", override_flag)
385+
let cmd_with_args_override = format!("example {override_flag} arg1 arg2")
386386
.split(' ')
387387
.map(|s| s.to_string())
388388
.collect::<Vec<String>>();
@@ -395,7 +395,7 @@ mod test {
395395
)
396396
);
397397

398-
let cmd_with_args_override = format!("{} example arg1 arg2", override_flag)
398+
let cmd_with_args_override = format!("{override_flag} example arg1 arg2")
399399
.split(' ')
400400
.map(|s| s.to_string())
401401
.collect::<Vec<String>>();

src/commands/new.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl TemplateNewCommandCore {
143143
let template = match &template_id {
144144
Some(template_id) => match template_manager
145145
.get(template_id)
146-
.with_context(|| format!("Error retrieving template {}", template_id))?
146+
.with_context(|| format!("Error retrieving template {template_id}"))?
147147
{
148148
Some(template) => template,
149149
None => match prompt_template(&template_manager, &variant, &[template_id.clone()])
@@ -416,7 +416,7 @@ mod tests {
416416
/// Writes to a new temporary file, closes it, and returns its path.
417417
fn create_tempfile(content: &str) -> Result<TempPath> {
418418
let mut file = NamedTempFile::new()?;
419-
write!(file, "{}", content).unwrap();
419+
write!(file, "{content}").unwrap();
420420
Ok(file.into_temp_path())
421421
}
422422

@@ -445,11 +445,7 @@ mod tests {
445445
];
446446
for content in bad_content {
447447
let file = create_tempfile(content).unwrap();
448-
assert!(
449-
values_from_file(&file).await.is_err(),
450-
"content: {}",
451-
content
452-
);
448+
assert!(values_from_file(&file).await.is_err(), "content: {content}");
453449
}
454450
}
455451

src/commands/plugins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ impl List {
683683
let json_vals: Vec<_> = plugins.iter().map(json_list_format).collect();
684684

685685
let json_text = serde_json::to_string_pretty(&json_vals)?;
686-
println!("{}", json_text);
686+
println!("{json_text}");
687687
Ok(())
688688
}
689689
}

src/commands/templates.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl Install {
178178
}
179179

180180
println!();
181-
println!("{}", table);
181+
println!("{table}");
182182
}
183183
if !skipped.is_empty() {
184184
println!();
@@ -193,7 +193,7 @@ impl Install {
193193
}
194194

195195
println!();
196-
println!("{}", table);
196+
println!("{table}");
197197
}
198198
}
199199
}
@@ -366,7 +366,7 @@ impl Upgrade {
366366
}
367367

368368
println!();
369-
println!("{}", table);
369+
println!("{table}");
370370
}
371371

372372
println!();
@@ -384,7 +384,7 @@ impl Upgrade {
384384
}
385385

386386
println!();
387-
println!("{}", table);
387+
println!("{table}");
388388
println!();
389389
}
390390
}
@@ -547,7 +547,7 @@ impl List {
547547
table.add_row(row);
548548
}
549549

550-
println!("{}", table);
550+
println!("{table}");
551551
}
552552

553553
if !warnings.is_empty() {
@@ -573,7 +573,7 @@ impl List {
573573
.collect();
574574

575575
let json_text = serde_json::to_string_pretty(&json_vals)?;
576-
println!("{}", json_text);
576+
println!("{json_text}");
577577
Ok(())
578578
}
579579
}
@@ -603,13 +603,13 @@ impl ProgressReporter for ConsoleProgressReporter {
603603
fn skipped_reason_text(reason: &SkippedReason) -> String {
604604
match reason {
605605
SkippedReason::AlreadyExists => "Already exists".to_owned(),
606-
SkippedReason::InvalidManifest(msg) => format!("Template load error: {}", msg),
606+
SkippedReason::InvalidManifest(msg) => format!("Template load error: {msg}"),
607607
}
608608
}
609609

610610
fn list_warn_reason_text(reason: &InstalledTemplateWarning) -> String {
611611
match reason {
612-
InstalledTemplateWarning::InvalidManifest(msg) => format!("Template load error: {}", msg),
612+
InstalledTemplateWarning::InvalidManifest(msg) => format!("Template load error: {msg}"),
613613
}
614614
}
615615

@@ -625,8 +625,7 @@ pub(crate) async fn prompt_install_default_templates(
625625
Ok(Some(template_manager.list().await?.templates))
626626
} else {
627627
println!(
628-
"You can install the default templates later with 'spin templates install --git {}'",
629-
DEFAULT_TEMPLATE_REPO
628+
"You can install the default templates later with 'spin templates install --git {DEFAULT_TEMPLATE_REPO}'"
630629
);
631630
Ok(None)
632631
}

src/subprocess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl std::fmt::Display for ExitStatusError {
2626
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2727
let _ = write!(f, "subprocess exited with status: ");
2828
if let Some(status) = self.status {
29-
writeln!(f, "{}", status)
29+
writeln!(f, "{status}")
3030
} else {
3131
writeln!(f, "unknown")
3232
}

tests/testcases/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ pub fn bootstrap_smoke_test(
336336
.unwrap_or_default()
337337
.clone_into(&mut custom_path);
338338
}
339-
build.env(key, format!("{}:{}", custom_path, path));
339+
build.env(key, format!("{custom_path}:{path}"));
340340
} else {
341341
build.env(key, value);
342342
}

0 commit comments

Comments
 (0)