Skip to content

Commit a4c477b

Browse files
committed
Apply clippy::uninlined_format_args fixes
1 parent efbb487 commit a4c477b

File tree

24 files changed

+77
-83
lines changed

24 files changed

+77
-83
lines changed

build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn get_git_sha() -> Option<String> {
1515
let symbolic = cmd(&["git", "rev-parse", "--symbolic", "HEAD"]).unwrap();
1616
let symbolic_full = cmd(&["git", "rev-parse", "--symbolic-full-name", "HEAD"]).unwrap();
1717

18-
println!("cargo:rerun-if-changed=.git/{}", symbolic);
18+
println!("cargo:rerun-if-changed=.git/{symbolic}");
1919
if symbolic != symbolic_full {
20-
println!("cargo:rerun-if-changed=.git/{}", symbolic_full);
20+
println!("cargo:rerun-if-changed=.git/{symbolic_full}");
2121
}
2222

2323
Some(sha)
@@ -31,5 +31,5 @@ fn main() {
3131
let sha = format!("{:?}", get_git_sha());
3232

3333
let output = std::env::var("OUT_DIR").unwrap();
34-
::std::fs::write(format!("{}/sha", output), sha.as_bytes()).unwrap();
34+
::std::fs::write(format!("{output}/sha"), sha.as_bytes()).unwrap();
3535
}

src/actions/experiments/edit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Action for EditExperiment {
5757
}
5858

5959
let changes = t.execute(
60-
&format!("UPDATE experiments SET {} = ?1 WHERE name = ?2;", col),
60+
&format!("UPDATE experiments SET {col} = ?1 WHERE name = ?2;"),
6161
&[&ex.toolchains[i].to_string(), &self.name],
6262
)?;
6363
assert_eq!(changes, 1);

src/agent/api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl ResponseExt for ::reqwest::blocking::Response {
5151
let status = self.status();
5252
let result: ApiResponse<T> = self
5353
.json()
54-
.with_context(|_| format!("failed to parse API response (status code {})", status,))?;
54+
.with_context(|_| format!("failed to parse API response (status code {status})",))?;
5555
match result {
5656
ApiResponse::Success { result } => Ok(result),
5757
ApiResponse::SlowDown => Err(AgentApiError::ServerUnavailable.into()),
@@ -78,7 +78,7 @@ impl AgentApi {
7878
}
7979

8080
fn build_request(&self, method: Method, url: &str) -> RequestBuilder {
81-
utils::http::prepare_sync(method, &format!("{}/agent-api/{}", self.url, url)).header(
81+
utils::http::prepare_sync(method, &format!("{}/agent-api/{url}", self.url)).header(
8282
AUTHORIZATION,
8383
(CraterToken {
8484
token: self.token.clone(),
@@ -101,7 +101,7 @@ impl AgentApi {
101101
// We retry these errors. Ideally it's something the
102102
// server would handle, but that's (unfortunately) hard
103103
// in practice.
104-
format!("{:?}", err).contains("database is locked")
104+
format!("{err:?}").contains("database is locked")
105105
};
106106

107107
if retry {

src/crates/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ impl Crate {
3535
Crate::Registry(ref details) => format!("reg/{}/{}", details.name, details.version),
3636
Crate::GitHub(ref repo) => {
3737
if let Some(ref sha) = repo.sha {
38-
format!("gh/{}/{}/{}", repo.org, repo.name, sha)
38+
format!("gh/{}/{}/{sha}", repo.org, repo.name)
3939
} else {
4040
format!("gh/{}/{}", repo.org, repo.name)
4141
}
4242
}
43-
Crate::Local(ref name) => format!("local/{}", name),
43+
Crate::Local(ref name) => format!("local/{name}"),
4444
Crate::Path(ref path) => {
4545
format!("path/{}", utf8_percent_encode(path, NON_ALPHANUMERIC))
4646
}
@@ -132,11 +132,11 @@ impl fmt::Display for Crate {
132132
Crate::Registry(ref krate) => format!("{}-{}", krate.name, krate.version),
133133
Crate::GitHub(ref repo) =>
134134
if let Some(ref sha) = repo.sha {
135-
format!("{}/{}/{}", repo.org, repo.name, sha)
135+
format!("{}/{}/{sha}", repo.org, repo.name)
136136
} else {
137137
format!("{}/{}", repo.org, repo.name)
138138
},
139-
Crate::Local(ref name) => format!("{} (local)", name),
139+
Crate::Local(ref name) => format!("{name} (local)"),
140140
Crate::Path(ref path) => format!("{}", utf8_percent_encode(path, NON_ALPHANUMERIC)),
141141
Crate::Git(ref repo) =>
142142
if let Some(ref sha) = repo.sha {

src/db/migrations.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {
153153
if let Ok(parsed) = serde_json::from_str(&legacy) {
154154
Ok(match parsed {
155155
LegacyToolchain::Dist(name) => name,
156-
LegacyToolchain::TryBuild { sha } => format!("try#{}", sha),
157-
LegacyToolchain::Master { sha } => format!("master#{}", sha),
156+
LegacyToolchain::TryBuild { sha } => format!("try#{sha}"),
157+
LegacyToolchain::Master { sha } => format!("master#{sha}"),
158158
})
159159
} else {
160160
Ok(legacy)
@@ -178,7 +178,7 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {
178178
[],
179179
)?;
180180
t.execute(
181-
&format!("UPDATE results SET toolchain = {}(toolchain);", fn_name),
181+
&format!("UPDATE results SET toolchain = {fn_name}(toolchain);"),
182182
[],
183183
)?;
184184
t.execute("PRAGMA foreign_keys = ON;", [])?;
@@ -352,17 +352,11 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {
352352

353353
t.execute("PRAGMA foreign_keys = OFF;", [])?;
354354
t.execute(
355-
&format!("UPDATE experiment_crates SET crate = {}(crate);", fn_name),
356-
[],
357-
)?;
358-
t.execute(
359-
&format!("UPDATE results SET crate = {}(crate);", fn_name),
360-
[],
361-
)?;
362-
t.execute(
363-
&format!("UPDATE crates SET crate = {}(crate);", fn_name),
355+
&format!("UPDATE experiment_crates SET crate = {fn_name}(crate);"),
364356
[],
365357
)?;
358+
t.execute(&format!("UPDATE results SET crate = {fn_name}(crate);"), [])?;
359+
t.execute(&format!("UPDATE crates SET crate = {fn_name}(crate);"), [])?;
366360
t.execute("PRAGMA foreign_keys = ON;", [])?;
367361

368362
Ok(())
@@ -406,7 +400,7 @@ pub fn execute(db: &mut Connection) -> Fallible<()> {
406400
MigrationKind::SQL(sql) => t.execute_batch(sql),
407401
MigrationKind::Code(code) => code(&t),
408402
}
409-
.with_context(|_| format!("error running migration: {}", name))?;
403+
.with_context(|_| format!("error running migration: {name}"))?;
410404

411405
t.execute("INSERT INTO migrations (name) VALUES (?1)", [&name])?;
412406
t.commit()?;

src/experiments.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ impl fmt::Display for CrateSelect {
9797
CrateSelect::Full => write!(f, "full"),
9898
CrateSelect::Demo => write!(f, "demo"),
9999
CrateSelect::Dummy => write!(f, "dummy"),
100-
CrateSelect::Top(n) => write!(f, "top-{}", n),
100+
CrateSelect::Top(n) => write!(f, "top-{n}"),
101101
CrateSelect::Local => write!(f, "local"),
102-
CrateSelect::Random(n) => write!(f, "random-{}", n),
102+
CrateSelect::Random(n) => write!(f, "random-{n}"),
103103
CrateSelect::List(list) => {
104104
let mut first = true;
105105
write!(f, "list:")?;
@@ -109,7 +109,7 @@ impl fmt::Display for CrateSelect {
109109
write!(f, ",")?;
110110
}
111111

112-
write!(f, "{}", krate)?;
112+
write!(f, "{krate}")?;
113113
first = false;
114114
}
115115

@@ -178,7 +178,7 @@ pub enum Assignee {
178178
impl fmt::Display for Assignee {
179179
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
180180
match self {
181-
Assignee::Agent(ref name) => write!(f, "agent:{}", name),
181+
Assignee::Agent(ref name) => write!(f, "agent:{name}"),
182182
Assignee::Distributed => write!(f, "distributed"),
183183
Assignee::CLI => write!(f, "cli"),
184184
}

src/report/archives.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn iterate<'a, DB: ReadResults + 'a>(
5050
let log = db
5151
.load_log(ex, tc, krate)
5252
.and_then(|c| c.ok_or_else(|| err_msg("missing logs")))
53-
.with_context(|_| format!("failed to read log of {} on {}", krate, tc));
53+
.with_context(|_| format!("failed to read log of {krate} on {tc}"));
5454

5555
let log_bytes: EncodedLog = match log {
5656
Ok(l) => l,
@@ -163,15 +163,15 @@ pub fn write_logs_archives<DB: ReadResults, W: ReportWriter>(
163163
for (comparison, archive) in by_comparison.drain(..) {
164164
let data = archive.into_inner()?.finish()?;
165165
dest.write_bytes(
166-
format!("logs-archives/{}.tar.gz", comparison),
166+
format!("logs-archives/{comparison}.tar.gz"),
167167
data,
168168
&"application/gzip".parse().unwrap(),
169169
EncodingType::Plain,
170170
)?;
171171

172172
archives.push(Archive {
173-
name: format!("{} crates", comparison),
174-
path: format!("logs-archives/{}.tar.gz", comparison),
173+
name: format!("{comparison} crates"),
174+
path: format!("logs-archives/{comparison}.tar.gz"),
175175
});
176176
}
177177

src/report/markdown.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn write_crate(
6666
let prefix = if is_child { " * " } else { "* " };
6767
let status_warning = krate
6868
.status
69-
.map(|status| format!(" ({})", status))
69+
.map(|status| format!(" ({status})"))
7070
.unwrap_or_default();
7171

7272
if let ReportConfig::Complete(toolchain) = comparison.report_config() {
@@ -106,7 +106,7 @@ fn render_markdown(context: &ResultsContext) -> Fallible<String> {
106106
writeln!(rendered, "# Crater report for {}\n\n", context.ex.name)?;
107107

108108
for (comparison, results) in context.categories.iter() {
109-
writeln!(rendered, "\n### {}", comparison)?;
109+
writeln!(rendered, "\n### {comparison}")?;
110110
match results {
111111
ReportCratesMD::Plain(crates) => {
112112
for krate in crates {

src/report/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ fn write_logs<DB: ReadResults, W: ReportWriter>(
293293
let content = db
294294
.load_log(ex, tc, krate)
295295
.and_then(|c| c.ok_or_else(|| err_msg("missing logs")))
296-
.with_context(|_| format!("failed to read log of {} on {}", krate, tc));
296+
.with_context(|_| format!("failed to read log of {krate} on {tc}"));
297297
let content = match content {
298298
Ok(c) => c,
299299
Err(e) => {
@@ -392,12 +392,12 @@ fn crate_to_name(c: &Crate) -> String {
392392
Crate::Registry(ref details) => format!("{}-{}", details.name, details.version),
393393
Crate::GitHub(ref repo) => {
394394
if let Some(ref sha) = repo.sha {
395-
format!("{}.{}.{}", repo.org, repo.name, sha)
395+
format!("{}.{}.{sha}", repo.org, repo.name)
396396
} else {
397397
format!("{}.{}", repo.org, repo.name)
398398
}
399399
}
400-
Crate::Local(ref name) => format!("{} (local)", name),
400+
Crate::Local(ref name) => format!("{name} (local)"),
401401
Crate::Path(ref path) => utf8_percent_encode(path, &REPORT_ENCODE_SET).to_string(),
402402
Crate::Git(ref repo) => {
403403
if let Some(ref sha) = repo.sha {
@@ -421,7 +421,7 @@ fn crate_to_url(c: &Crate) -> String {
421421
),
422422
Crate::GitHub(ref repo) => {
423423
if let Some(ref sha) = repo.sha {
424-
format!("https://github.com/{}/{}/tree/{}", repo.org, repo.name, sha)
424+
format!("https://github.com/{}/{}/tree/{sha}", repo.org, repo.name)
425425
} else {
426426
format!("https://github.com/{}/{}", repo.org, repo.name)
427427
}
@@ -499,7 +499,7 @@ fn compare(
499499
| (TestPass, TestSkipped)
500500
| (TestSkipped, TestFail(_))
501501
| (TestSkipped, TestPass) => {
502-
panic!("can't compare {} and {}", res1, res2);
502+
panic!("can't compare {res1} and {res2}");
503503
}
504504
},
505505
_ if config.should_skip(krate) => Comparison::Skipped,

src/report/s3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ mod tests {
229229
"s3://bucket:80",
230230
"s3://bucket/path/prefix?query#fragment",
231231
] {
232-
assert!(S3Prefix::from_str(bad).is_err(), "valid bad url: {}", bad);
232+
assert!(S3Prefix::from_str(bad).is_err(), "valid bad url: {bad}");
233233
}
234234
}
235235
}

0 commit comments

Comments
 (0)