Skip to content

chore: fix clippy uninlined_format_args #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gitlab-runner-mock/src/api/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Respond for JobTraceResponder {
)
.insert_header("Job-Status", &*job.state().to_string()),
Err(e) => ResponseTemplate::new(StatusCode::RANGE_NOT_SATISFIABLE)
.set_body_string(format!("{:?}", e)),
.set_body_string(format!("{e:?}")),
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions gitlab-runner-mock/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Display for MockJobState {
// if it's not *identical* to the exact GitLab job status.
MockJobState::Cancelled => "canceled",
};
write!(f, "{}", d)
write!(f, "{d}")
}
}

Expand Down Expand Up @@ -158,7 +158,7 @@ impl MockJob {
Self {
name,
id,
token: format!("job-token-{}", id),
token: format!("job-token-{id}"),
variables: Vec::new(),
steps: Vec::new(),
dependencies: Vec::new(),
Expand Down
8 changes: 4 additions & 4 deletions gitlab-runner/examples/demo-runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Run {
async fn get_facts(&self, amount: u8) -> Result<Vec<String>, ()> {
let mut url = Url::parse("https://catfact.ninja/facts").unwrap();
url.query_pairs_mut()
.append_pair("limit", &format!("{}", amount));
.append_pair("limit", &format!("{amount}"));

let mut r: Reply = self
.client
Expand Down Expand Up @@ -148,7 +148,7 @@ impl UploadableFile for DemoFile {
fn get_path(&self) -> Cow<'_, str> {
match self {
Self::ReadMe => "README.md".into(),
Self::Fact { index, .. } => format!("fact_{}.txt", index).into(),
Self::Fact { index, .. } => format!("fact_{index}.txt").into(),
}
}

Expand Down Expand Up @@ -224,7 +224,7 @@ async fn main() -> Result<()> {
option_env!("VERGEN_GIT_SHA")
.map(|sha| {
if option_env!("VERGEN_GIT_DIRTY") == Some("true") {
format!("{}-dirty", sha)
format!("{sha}-dirty")
} else {
sha.to_string()
}
Expand Down Expand Up @@ -254,7 +254,7 @@ async fn main() -> Result<()> {
8,
) => match r {
Ok(_) => info!("Runner exited"),
Err(e) => panic!("Failed to pick up new jobs: {}", e)
Err(e) => panic!("Failed to pick up new jobs: {e}")
},
_ = term.recv() => info!("Got TERM: exiting!"),
_ = int.recv() => info!("Got INT: exiting!"),
Expand Down
10 changes: 5 additions & 5 deletions gitlab-runner/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl std::fmt::Display for ArtifactFormat {
Self::Gzip => "gzip",
Self::Raw => "raw",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}

Expand Down Expand Up @@ -358,7 +358,7 @@ impl Client {
state: JobState,
) -> Result<JobUpdateReply, Error> {
let mut url = self.url.clone();
let id_s = format!("{}", id);
let id_s = format!("{id}");
url.path_segments_mut()
.unwrap()
.extend(&["api", "v4", "jobs", &id_s]);
Expand Down Expand Up @@ -397,7 +397,7 @@ impl Client {
}

let mut url = self.url.clone();
let id_s = format!("{}", id);
let id_s = format!("{id}");
url.path_segments_mut()
.unwrap()
.extend(&["api", "v4", "jobs", &id_s, "trace"]);
Expand Down Expand Up @@ -435,7 +435,7 @@ impl Client {
mut dest: D,
) -> Result<(), Error> {
let mut url = self.url.clone();
let id_s = format!("{}", id);
let id_s = format!("{id}");
url.path_segments_mut()
.unwrap()
.extend(&["api", "v4", "jobs", &id_s, "artifacts"]);
Expand Down Expand Up @@ -481,7 +481,7 @@ impl Client {
};

let mut url = self.url.clone();
let id_s = format!("{}", id);
let id_s = format!("{id}");
url.path_segments_mut()
.unwrap()
.extend(&["api", "v4", "jobs", &id_s, "artifacts"]);
Expand Down
2 changes: 1 addition & 1 deletion gitlab-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl RunnerBuilder {
// 2 hex chars for each byte
for b in &mac.finalize().into_bytes()[0..Self::DEFAULT_ID_LEN / 2] {
// Infallible: writing to a string
write!(&mut system_id, "{:02x}", b).unwrap();
write!(&mut system_id, "{b:02x}").unwrap();
}
Some(system_id)
}
Expand Down
4 changes: 2 additions & 2 deletions gitlab-runner/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ struct OutputToGitlab {
impl field::Visit for OutputToGitlab {
fn record_str(&mut self, field: &field::Field, value: &str) {
if field.name() == "message" {
self.joblog.trace(format!("{}\n", value).as_bytes());
self.joblog.trace(format!("{value}\n").as_bytes());
}
}

fn record_debug(&mut self, field: &field::Field, value: &dyn std::fmt::Debug) {
if field.name() == "message" {
self.joblog.trace(format!("{:?}\n", value).as_bytes());
self.joblog.trace(format!("{value:?}\n").as_bytes());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gitlab-runner/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ where
Ret: Future<Output = Result<J, ()>>,
{
if let Err(e) = tokio::fs::create_dir(&build_dir).await {
job.trace(format!("Failed to remove build dir: {}", e));
job.trace(format!("Failed to remove build dir: {e}"));
return Err(());
}
let mut handler = process(job).await?;
Expand Down
4 changes: 2 additions & 2 deletions gitlab-runner/src/uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ impl AsyncWrite for UploadFile<'_> {
fn make_artifact_name(base: Option<&str>, format: &ArtifactFormat) -> String {
let name = base.unwrap_or(DEFAULT_ARTIFACT_NAME);
match format {
ArtifactFormat::Zip => format!("{}.zip", name),
ArtifactFormat::Gzip => format!("{}.gz", name),
ArtifactFormat::Zip => format!("{name}.zip"),
ArtifactFormat::Gzip => format!("{name}.gz"),
ArtifactFormat::Raw => unimplemented!("Raw artifacts are not supported."),
}
}
Expand Down
2 changes: 1 addition & 1 deletion gitlab-runner/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ async fn runner_limit() {
}
let running = jobs.running();

assert!(running <= JOB_LIMIT, "running {} > {}", running, N_JOBS);
assert!(running <= JOB_LIMIT, "running {running} > {N_JOBS}");
if running == JOB_LIMIT || jobs.pending() == 0 {
if let Some(j) = jobs.jobs().iter().find(|j| j.is_running()) {
if !j.completed() {
Expand Down