Skip to content

Commit da8bd6b

Browse files
authored
chore: fix clippy uninlined_format_args (#96)
2 parents df1a461 + 7d645f2 commit da8bd6b

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

gitlab-runner-mock/src/api/trace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Respond for JobTraceResponder {
5959
)
6060
.insert_header("Job-Status", &*job.state().to_string()),
6161
Err(e) => ResponseTemplate::new(StatusCode::RANGE_NOT_SATISFIABLE)
62-
.set_body_string(format!("{:?}", e)),
62+
.set_body_string(format!("{e:?}")),
6363
}
6464
}
6565
} else {

gitlab-runner-mock/src/job.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Display for MockJobState {
3737
// if it's not *identical* to the exact GitLab job status.
3838
MockJobState::Cancelled => "canceled",
3939
};
40-
write!(f, "{}", d)
40+
write!(f, "{d}")
4141
}
4242
}
4343

@@ -158,7 +158,7 @@ impl MockJob {
158158
Self {
159159
name,
160160
id,
161-
token: format!("job-token-{}", id),
161+
token: format!("job-token-{id}"),
162162
variables: Vec::new(),
163163
steps: Vec::new(),
164164
dependencies: Vec::new(),

gitlab-runner/examples/demo-runner.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Run {
5353
async fn get_facts(&self, amount: u8) -> Result<Vec<String>, ()> {
5454
let mut url = Url::parse("https://catfact.ninja/facts").unwrap();
5555
url.query_pairs_mut()
56-
.append_pair("limit", &format!("{}", amount));
56+
.append_pair("limit", &format!("{amount}"));
5757

5858
let mut r: Reply = self
5959
.client
@@ -148,7 +148,7 @@ impl UploadableFile for DemoFile {
148148
fn get_path(&self) -> Cow<'_, str> {
149149
match self {
150150
Self::ReadMe => "README.md".into(),
151-
Self::Fact { index, .. } => format!("fact_{}.txt", index).into(),
151+
Self::Fact { index, .. } => format!("fact_{index}.txt").into(),
152152
}
153153
}
154154

@@ -224,7 +224,7 @@ async fn main() -> Result<()> {
224224
option_env!("VERGEN_GIT_SHA")
225225
.map(|sha| {
226226
if option_env!("VERGEN_GIT_DIRTY") == Some("true") {
227-
format!("{}-dirty", sha)
227+
format!("{sha}-dirty")
228228
} else {
229229
sha.to_string()
230230
}
@@ -254,7 +254,7 @@ async fn main() -> Result<()> {
254254
8,
255255
) => match r {
256256
Ok(_) => info!("Runner exited"),
257-
Err(e) => panic!("Failed to pick up new jobs: {}", e)
257+
Err(e) => panic!("Failed to pick up new jobs: {e}")
258258
},
259259
_ = term.recv() => info!("Got TERM: exiting!"),
260260
_ = int.recv() => info!("Got INT: exiting!"),

gitlab-runner/src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl std::fmt::Display for ArtifactFormat {
200200
Self::Gzip => "gzip",
201201
Self::Raw => "raw",
202202
};
203-
write!(f, "{}", s)
203+
write!(f, "{s}")
204204
}
205205
}
206206

@@ -358,7 +358,7 @@ impl Client {
358358
state: JobState,
359359
) -> Result<JobUpdateReply, Error> {
360360
let mut url = self.url.clone();
361-
let id_s = format!("{}", id);
361+
let id_s = format!("{id}");
362362
url.path_segments_mut()
363363
.unwrap()
364364
.extend(&["api", "v4", "jobs", &id_s]);
@@ -397,7 +397,7 @@ impl Client {
397397
}
398398

399399
let mut url = self.url.clone();
400-
let id_s = format!("{}", id);
400+
let id_s = format!("{id}");
401401
url.path_segments_mut()
402402
.unwrap()
403403
.extend(&["api", "v4", "jobs", &id_s, "trace"]);
@@ -435,7 +435,7 @@ impl Client {
435435
mut dest: D,
436436
) -> Result<(), Error> {
437437
let mut url = self.url.clone();
438-
let id_s = format!("{}", id);
438+
let id_s = format!("{id}");
439439
url.path_segments_mut()
440440
.unwrap()
441441
.extend(&["api", "v4", "jobs", &id_s, "artifacts"]);
@@ -481,7 +481,7 @@ impl Client {
481481
};
482482

483483
let mut url = self.url.clone();
484-
let id_s = format!("{}", id);
484+
let id_s = format!("{id}");
485485
url.path_segments_mut()
486486
.unwrap()
487487
.extend(&["api", "v4", "jobs", &id_s, "artifacts"]);

gitlab-runner/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl RunnerBuilder {
343343
// 2 hex chars for each byte
344344
for b in &mac.finalize().into_bytes()[0..Self::DEFAULT_ID_LEN / 2] {
345345
// Infallible: writing to a string
346-
write!(&mut system_id, "{:02x}", b).unwrap();
346+
write!(&mut system_id, "{b:02x}").unwrap();
347347
}
348348
Some(system_id)
349349
}

gitlab-runner/src/logging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ struct OutputToGitlab {
4747
impl field::Visit for OutputToGitlab {
4848
fn record_str(&mut self, field: &field::Field, value: &str) {
4949
if field.name() == "message" {
50-
self.joblog.trace(format!("{}\n", value).as_bytes());
50+
self.joblog.trace(format!("{value}\n").as_bytes());
5151
}
5252
}
5353

5454
fn record_debug(&mut self, field: &field::Field, value: &dyn std::fmt::Debug) {
5555
if field.name() == "message" {
56-
self.joblog.trace(format!("{:?}\n", value).as_bytes());
56+
self.joblog.trace(format!("{value:?}\n").as_bytes());
5757
}
5858
}
5959
}

gitlab-runner/src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ where
3030
Ret: Future<Output = Result<J, ()>>,
3131
{
3232
if let Err(e) = tokio::fs::create_dir(&build_dir).await {
33-
job.trace(format!("Failed to remove build dir: {}", e));
33+
job.trace(format!("Failed to remove build dir: {e}"));
3434
return Err(());
3535
}
3636
let mut handler = process(job).await?;

gitlab-runner/src/uploader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ impl AsyncWrite for UploadFile<'_> {
180180
fn make_artifact_name(base: Option<&str>, format: &ArtifactFormat) -> String {
181181
let name = base.unwrap_or(DEFAULT_ARTIFACT_NAME);
182182
match format {
183-
ArtifactFormat::Zip => format!("{}.zip", name),
184-
ArtifactFormat::Gzip => format!("{}.gz", name),
183+
ArtifactFormat::Zip => format!("{name}.zip"),
184+
ArtifactFormat::Gzip => format!("{name}.gz"),
185185
ArtifactFormat::Raw => unimplemented!("Raw artifacts are not supported."),
186186
}
187187
}

gitlab-runner/tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ async fn runner_limit() {
595595
}
596596
let running = jobs.running();
597597

598-
assert!(running <= JOB_LIMIT, "running {} > {}", running, N_JOBS);
598+
assert!(running <= JOB_LIMIT, "running {running} > {N_JOBS}");
599599
if running == JOB_LIMIT || jobs.pending() == 0 {
600600
if let Some(j) = jobs.jobs().iter().find(|j| j.is_running()) {
601601
if !j.completed() {

0 commit comments

Comments
 (0)