Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 344f250

Browse files
committed
Thanks clippy
This applies some changes recommended by clippy that have caused the clippy check to start failingo on CI as in: https://github.com/EliahKagan/cargo-smart-release/actions/runs/16672703924/job/47192391862 This was done by running `cargo clippy --fix` followed by `cargo fmt` and inspecting the result.
1 parent bee3e4c commit 344f250

9 files changed

Lines changed: 14 additions & 18 deletions

File tree

src/changelog/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn record_unknown_range(out: &mut Vec<section::Segment>, range: Option<Range<usi
427427
}
428428

429429
fn track_unknown_event(unknown_event: Event<'_>, unknown: &mut String) {
430-
log::trace!("Cannot handle {:?}", unknown_event);
430+
log::trace!("Cannot handle {unknown_event:?}");
431431
match unknown_event {
432432
Event::Html(text)
433433
| Event::Code(text)

src/command/changelog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn changelog(opts: Options, crates: Vec<String>) -> anyhow::Result<()> {
129129
change.commit()?;
130130
}
131131
if num_changes != 0 {
132-
log::info!("Wrote {} changelogs", num_changes);
132+
log::info!("Wrote {num_changes} changelogs");
133133
}
134134

135135
Ok(())

src/command/release/cargo.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ pub(in crate::command::release_impl) fn publish_crate(
5656
bail!("Could not successfully execute 'cargo publish'.")
5757
} else {
5858
log::warn!(
59-
"'cargo publish' run {} failed but we retry up to {} times to rule out flakiness",
60-
attempt,
61-
max_attempts
59+
"'cargo publish' run {attempt} failed but we retry up to {max_attempts} times to rule out flakiness"
6260
);
6361
}
6462
}

src/command/release/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub(in crate::command::release_impl) fn create_version_tag<'repo>(
5656
);
5757
}
5858
None => {
59-
log::trace!("WOULD create tag {}", tag_name);
59+
log::trace!("WOULD create tag {tag_name}");
6060
}
6161
}
6262
Ok(Some(format!("refs/tags/{tag_name}").try_into()?))

src/command/release/github.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ pub fn create_release(
6464
cmd.arg(notes);
6565
if !dry_run && !cmd.status()?.success() {
6666
log::warn!(
67-
"'gh' tool execution failed - considering this non-critical, and you may try to create the release with: {:?}",
68-
cmd
67+
"'gh' tool execution failed - considering this non-critical, and you may try to create the release with: {cmd:?}"
6968
);
7069
}
7170
Ok(())

src/command/release/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn commit_locks_and_generate_bail_message(
246246
);
247247
if !allow_fully_generated_changelogs {
248248
for crate_name in crate_names {
249-
log::warn!("{} {}", fix_preamble, crate_name);
249+
log::warn!("{fix_preamble} {crate_name}");
250250
}
251251
}
252252
}

src/command/release/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,11 @@ fn present_and_validate_dependencies(
358358
.map(|d| d.package.name.as_str())
359359
.collect::<Vec<_>>();
360360
if !crate_names_for_manifest_updates.is_empty() {
361-
let plural_s = (crate_names_for_manifest_updates.len() > 1)
362-
.then_some("s")
363-
.unwrap_or_default();
361+
let plural_s = if crate_names_for_manifest_updates.len() > 1 {
362+
"s"
363+
} else {
364+
Default::default()
365+
};
364366
log::info!(
365367
"{} adjust version constraints in manifest{} of {} package{} as direct dependencies are changing: {}",
366368
will(dry_run),
@@ -502,7 +504,7 @@ fn wait_for_release(
502504
}
503505

504506
std::thread::sleep(sleep_time);
505-
log::info!("attempt {}", attempt);
507+
log::info!("attempt {attempt}");
506508
}
507509
Ok(())
508510
}

src/context.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ fn fill_in_root_crate_if_needed(crate_names: Vec<String>) -> anyhow::Result<Vec<
8484
} else {
8585
dir_name.to_owned()
8686
};
87-
log::warn!(
88-
"Using '{}' as crate name as no one was provided. Specify one if this isn't correct",
89-
crate_name
90-
);
87+
log::warn!("Using '{crate_name}' as crate name as no one was provided. Specify one if this isn't correct");
9188
vec![crate_name]
9289
} else {
9390
crate_names

src/git/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn change_since_last_release(package: &Package, ctx: &crate::Context) -> any
4949
.peel_to_kind(object::Kind::Tree)?
5050
.into_tree()
5151
.peel_to_entry(components.clone())?
52-
.unwrap_or_else(|| panic!("path '{}' must exist in current_commit `{}`", dir, current_commit))
52+
.unwrap_or_else(|| panic!("path '{dir}' must exist in current_commit `{current_commit}`"))
5353
.object_id();
5454
if let Some(released_dir_entry) = released_target
5555
.object()?

0 commit comments

Comments
 (0)