Skip to content

Commit ec205f5

Browse files
committed
Fixed clippy warnings for rust 1.88.0
1 parent eed0946 commit ec205f5

42 files changed

Lines changed: 119 additions & 149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/hyperqueue/src/bin/hq.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,11 @@ fn hq_panic_hook(_info: &PanicHookInfo) {
376376
If you would be so kind, please report this issue at the HQ issue tracker: https://github.com/It4innovations/hyperqueue/issues/new?title=HQ%20crashes
377377
Please include the above error (starting from "thread ... panicked ...") and the stack backtrace in the issue contents, along with the following information:
378378
379-
HyperQueue version: {version}
379+
HyperQueue version: {HQ_VERSION}
380380
381381
You can also re-run HyperQueue server (and its workers) with the `RUST_LOG=hq=debug,tako=debug`
382382
environment variable, and attach the logs to the issue, to provide us more information.
383-
"#,
384-
version = HQ_VERSION
383+
"#
385384
);
386385

387386
if io::stdout().is_terminal() {

crates/hyperqueue/src/client/commands/job.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,13 @@ pub async fn cancel_job(
267267
)
268268
}
269269
CancelJobResponse::Canceled(_, _) => {
270-
log::error!(
271-
"Canceling job {} failed; all tasks are already finished",
272-
job_id
273-
)
270+
log::error!("Canceling job {job_id} failed; all tasks are already finished")
274271
}
275272
CancelJobResponse::InvalidJob => {
276-
log::error!("Canceling job {} failed; job not found", job_id)
273+
log::error!("Canceling job {job_id} failed; job not found")
277274
}
278275
CancelJobResponse::Failed(msg) => {
279-
log::error!("Canceling job {} failed; {}", job_id, msg)
276+
log::error!("Canceling job {job_id} failed; {msg}")
280277
}
281278
}
282279
}
@@ -302,13 +299,13 @@ pub async fn close_job(
302299
for (job_id, response) in responses {
303300
match response {
304301
CloseJobResponse::Closed => {
305-
log::info!("Job {} closed", job_id)
302+
log::info!("Job {job_id} closed")
306303
}
307304
CloseJobResponse::InvalidJob => {
308-
log::error!("Closing job {} failed; job not found", job_id)
305+
log::error!("Closing job {job_id} failed; job not found")
309306
}
310307
CloseJobResponse::AlreadyClosed => {
311-
log::error!("Closing job {} failed; job is already closed", job_id)
308+
log::error!("Closing job {job_id} failed; job is already closed")
312309
}
313310
}
314311
}

crates/hyperqueue/src/client/commands/submit/command.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,8 @@ fn warn_missing_task_id(opts: &JobSubmitOpts, task_count: u32) {
875875
let path_has_cwd = placeholders.contains(&StringPart::Placeholder(CWD_PLACEHOLDER));
876876
if !path_has_task_id && (!path_has_cwd || !cwd_has_task_id) {
877877
log::warn!(
878-
"You have submitted an array job, but the `{}` path does not contain the task ID placeholder.\n\
879-
Individual tasks might thus overwrite the file. Consider adding `%{{{}}}` to the `--{}` value.",
880-
stream,
881-
TASK_ID_PLACEHOLDER,
882-
stream
878+
"You have submitted an array job, but the `{stream}` path does not contain the task ID placeholder.\n\
879+
Individual tasks might thus overwrite the file. Consider adding `%{{{TASK_ID_PLACEHOLDER}}}` to the `--{stream}` value."
883880
);
884881
}
885882
}

crates/hyperqueue/src/client/commands/submit/directives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn parse_hq_directives(
121121

122122
// clap parses first argument as name of the program
123123
arguments.insert(0, "".to_string());
124-
log::debug!("Applying directive(s): {:?}", arguments);
124+
log::debug!("Applying directive(s): {arguments:?}");
125125

126126
let app = SubmitJobTaskConfOpts::command()
127127
.disable_help_flag(true)

crates/hyperqueue/src/client/commands/worker.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,16 +428,16 @@ pub async fn stop_worker(session: &mut ClientSession, selector: IdSelector) -> c
428428
for (id, response) in responses {
429429
match response {
430430
StopWorkerResponse::Failed(e) => {
431-
log::error!("Stopping worker {} failed; {}", id, e);
431+
log::error!("Stopping worker {id} failed; {e}");
432432
}
433433
StopWorkerResponse::InvalidWorker => {
434-
log::error!("Stopping worker {} failed; worker not found", id);
434+
log::error!("Stopping worker {id} failed; worker not found");
435435
}
436436
StopWorkerResponse::AlreadyStopped => {
437-
log::warn!("Stopping worker {} failed; worker is already stopped", id);
437+
log::warn!("Stopping worker {id} failed; worker is already stopped");
438438
}
439439
StopWorkerResponse::Stopped => {
440-
log::info!("Worker {} stopped", id)
440+
log::info!("Worker {id} stopped")
441441
}
442442
}
443443
}

crates/hyperqueue/src/client/output/cli.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl CliOutput {
9696
fn print_table(&self, table: TableStruct) {
9797
let table = table.color_choice(self.color_policy);
9898
if let Err(e) = print_stdout(table) {
99-
log::error!("Cannot print table to stdout: {:?}", e);
99+
log::error!("Cannot print table to stdout: {e:?}");
100100
}
101101
}
102102

@@ -380,9 +380,9 @@ impl Output for CliOutput {
380380
assigned_tasks,
381381
is_reserved,
382382
} => {
383-
write!(s, "assigned tasks: {}", assigned_tasks).unwrap();
383+
write!(s, "assigned tasks: {assigned_tasks}").unwrap();
384384
if running_tasks > 0 {
385-
write!(s, "; running tasks: {}", running_tasks).unwrap();
385+
write!(s, "; running tasks: {running_tasks}").unwrap();
386386
}
387387
if is_reserved {
388388
write!(s, "; reserved for a multi-node task").unwrap();
@@ -467,7 +467,7 @@ impl Output for CliOutput {
467467
println!("{}", job_task_ids[0].1);
468468
} else {
469469
for (job_id, array) in &job_task_ids {
470-
println!("{}: {}", job_id, array);
470+
println!("{job_id}: {array}");
471471
}
472472
}
473473
}
@@ -1367,10 +1367,7 @@ pub fn print_job_output(
13671367
Err(error) => log::warn!("File `{path}` cannot be opened: {error:?}"),
13681368
};
13691369
} else {
1370-
log::warn!(
1371-
"Task {} has no `{stream_name}` stream associated with it",
1372-
task_id
1373-
);
1370+
log::warn!("Task {task_id} has no `{stream_name}` stream associated with it");
13741371
}
13751372
};
13761373

@@ -1605,9 +1602,9 @@ fn format_descriptor_kind(kind: &ResourceDescriptorKind) -> String {
16051602
)
16061603
)
16071604
}
1608-
ResourceDescriptorKind::Range { start, end } if start == end => format!("[{}]", start),
1609-
ResourceDescriptorKind::Range { start, end } => format!("range({}-{})", start, end),
1610-
ResourceDescriptorKind::Sum { size } => format!("sum({})", size),
1605+
ResourceDescriptorKind::Range { start, end } if start == end => format!("[{start}]"),
1606+
ResourceDescriptorKind::Range { start, end } => format!("range({start}-{end})"),
1607+
ResourceDescriptorKind::Sum { size } => format!("sum({size})"),
16111608
}
16121609
}
16131610

@@ -1702,16 +1699,16 @@ fn explanation_item_to_strings(
17021699
worker_amount,
17031700
} => (
17041701
resource.color(colored::Color::Cyan),
1705-
format!("{}", worker_amount).color(colored::Color::Yellow),
1706-
format!("{}", request_amount).color(request_color),
1702+
format!("{worker_amount}").color(colored::Color::Yellow),
1703+
format!("{request_amount}").color(request_color),
17071704
),
17081705
TaskExplainItem::WorkerGroup {
17091706
n_nodes,
17101707
group_size,
17111708
} => (
17121709
"nodes".color(colored::Color::Magenta),
1713-
format!("group size {}", group_size).color(colored::Color::Yellow),
1714-
format!("{}", n_nodes).color(request_color),
1710+
format!("group size {group_size}").color(colored::Color::Yellow),
1711+
format!("{n_nodes}").color(request_color),
17151712
),
17161713
}
17171714
}

crates/hyperqueue/src/client/output/quiet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Output for Quiet {
7272
}
7373

7474
fn print_job_open(&self, job_id: JobId) {
75-
println!("{}", job_id);
75+
println!("{job_id}");
7676
}
7777

7878
fn print_job_list(&self, jobs: Vec<JobInfo>, _total_jobs: usize) {

crates/hyperqueue/src/common/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn human_size(size: u64) -> String {
3030
pub fn human_mem_amount(amount: ResourceAmount) -> String {
3131
let f = amount.as_f32();
3232
if f < 512f32 {
33-
format!("{:.2} MiB", f)
33+
format!("{f:.2} MiB")
3434
} else {
3535
format!("{:.2} GiB", f / 1024.0)
3636
}

crates/hyperqueue/src/dashboard/ui/screens/root_screen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn render_timeline(data: &DashboardData, rect: Rect, frame: &mut Frame) {
254254

255255
let offset = offset_duration(data).as_secs();
256256
let offset = if offset < 60 {
257-
format!("{}s", offset)
257+
format!("{offset}s")
258258
} else {
259259
format!("{}m", offset / 60)
260260
};

crates/hyperqueue/src/server/autoalloc/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ not be removed. Use `--force` if you want to remove the queue anyway"
705705

706706
for (result, allocation_id) in futures::future::join_all(remove_alloc_fut).await {
707707
match result {
708-
Ok(_) => log::info!("Allocation {} was removed", allocation_id),
709-
Err(e) => log::error!("Failed to remove allocation {}: {:?}", allocation_id, e),
708+
Ok(_) => log::info!("Allocation {allocation_id} was removed"),
709+
Err(e) => log::error!("Failed to remove allocation {allocation_id}: {e:?}"),
710710
}
711711
}
712712

0 commit comments

Comments
 (0)