From d00758ba0488530d7497ec56f508fff118805be1 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 1 Aug 2024 08:03:14 +0200 Subject: [PATCH] fix clippy --- src/command/changelog.rs | 14 +++++++------- src/command/release/manifest.rs | 4 ++-- src/git/mod.rs | 5 ++++- src/traverse.rs | 1 + 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/command/changelog.rs b/src/command/changelog.rs index 0f27131..188cf17 100644 --- a/src/command/changelog.rs +++ b/src/command/changelog.rs @@ -104,7 +104,7 @@ pub fn changelog(opts: Options, crates: Vec) -> anyhow::Result<()> { if let Some(bat) = bat.as_ref() { bat.display_to_tty( lock.lock_path(), - lock.resource_path().strip_prefix(&ctx.root.to_path_buf())?, + lock.resource_path().strip_prefix(ctx.root.to_path_buf())?, format!("PREVIEW {} / {}, press Ctrl+C to cancel", idx + 1, crates.len()), )?; } @@ -141,11 +141,11 @@ fn assure_working_tree_is_unchanged(options: Options) -> anyhow::Result<()> { Ok(()) } else { crate::git::assure_clean_working_tree().or_else(|err| - if options.dry_run { - log::warn!("The working tree has changes which will prevent changelog updates with --write unless --allow-dirty is also specified. The latter isn't recommended."); - Ok(()) - } else { - Err(err) - }) + if options.dry_run { + log::warn!("The working tree has changes which will prevent changelog updates with --write unless --allow-dirty is also specified. The latter isn't recommended."); + Ok(()) + } else { + Err(err) + }) } } diff --git a/src/command/release/manifest.rs b/src/command/release/manifest.rs index 967c5cd..3734677 100644 --- a/src/command/release/manifest.rs +++ b/src/command/release/manifest.rs @@ -281,7 +281,7 @@ fn preview_changelogs( ); bat.display_to_tty( lock.lock_path(), - lock.resource_path().strip_prefix(&ctx.base.root.to_path_buf())?, + lock.resource_path().strip_prefix(ctx.base.root.to_path_buf())?, additional_info, )?; } @@ -534,7 +534,7 @@ fn set_version_and_update_package_dependency( let force_update = conservative_pre_release_version_handling && version::is_pre_release(new_version) // setting the lower bound unnecessarily can be harmful // don't claim to be conservative if this is necessary anyway - && req_as_version(&version_req).map_or(false, |req_version|!version::rhs_is_breaking_bump_for_lhs(&req_version, new_version)); + && req_as_version(&version_req).map_or(false, |req_version| !version::rhs_is_breaking_bump_for_lhs(&req_version, new_version)); if !version_req.matches(new_version) || force_update { if !version_req_unset_or_default(&version_req) { bail!( diff --git a/src/git/mod.rs b/src/git/mod.rs index e878e2b..55430d2 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs @@ -14,7 +14,10 @@ pub mod history; #[derive(Clone, Debug)] pub enum PackageChangeKind { - Untagged { wanted_tag_name: String }, + Untagged { + #[allow(dead_code)] // only used for debug printing maybe? + wanted_tag_name: String, + }, ChangedOrNew, } diff --git a/src/traverse.rs b/src/traverse.rs index d328203..7bcba80 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -56,6 +56,7 @@ pub mod dependency { Breakage { bump: version::Bump, /// Set if there is a change at all, which might not be the case for previously skipped crates. + #[allow(dead_code)] // strange that this isn't used, indeed! change: Option, /// The direct dependency causing the breakage because it's breaking itself causing_dependency_names: Vec,