chore: fix clippy warnings
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
bc3e091f45
commit
2d5abedf1a
@ -135,24 +135,18 @@ impl ChangeLog<'_> {
|
||||
.context("cannot convert bytes to string (contains non utf-8 char indices)")
|
||||
}
|
||||
|
||||
fn default_config<'a>(&self) -> Config {
|
||||
fn default_config(&self) -> Config {
|
||||
let config = Config {
|
||||
changelog: default_changelog_config(
|
||||
None,
|
||||
self.release_link.as_deref(),
|
||||
),
|
||||
changelog: default_changelog_config(None, self.release_link.as_deref()),
|
||||
git: default_git_config(),
|
||||
};
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
fn default_config_with_header<'a>(&self, header: Option<String>) -> Config {
|
||||
fn default_config_with_header(&self, header: Option<String>) -> Config {
|
||||
let config = Config {
|
||||
changelog: default_changelog_config(
|
||||
header,
|
||||
self.release_link.as_deref(),
|
||||
),
|
||||
changelog: default_changelog_config(header, self.release_link.as_deref()),
|
||||
git: default_git_config(),
|
||||
};
|
||||
|
||||
@ -219,9 +213,9 @@ fn default_changelog_config(header: Option<String>, release_link: Option<&str>)
|
||||
}
|
||||
|
||||
fn default_changelog_body_config(release_link: Option<&str>) -> String {
|
||||
const pre: &str = r#"
|
||||
const PRE: &str = r#"
|
||||
## [{{ version | trim_start_matches(pat="v") }}]"#;
|
||||
const post: &str = r#" - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
const POST: &str = r#" - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits %}
|
||||
@ -234,8 +228,8 @@ fn default_changelog_body_config(release_link: Option<&str>) -> String {
|
||||
{% endfor %}"#;
|
||||
|
||||
match release_link {
|
||||
Some(link) => format!("{}{}{}", pre, link, post),
|
||||
None => format!("{}{}", pre, post),
|
||||
Some(link) => format!("{}{}{}", PRE, link, POST),
|
||||
None => format!("{}{}", PRE, POST),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ use crate::{
|
||||
versioning::{next_version::NextVersion, semver::get_most_significant_version},
|
||||
};
|
||||
|
||||
type StdinFn = Option<Arc<Mutex<dyn Fn() -> anyhow::Result<String> + Send + Sync + 'static>>>;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Command {
|
||||
@ -32,7 +34,7 @@ pub struct Command {
|
||||
ui: DynUi,
|
||||
|
||||
#[clap(skip)]
|
||||
stdin: Option<Arc<Mutex<dyn Fn() -> anyhow::Result<String> + Send + Sync + 'static>>>,
|
||||
stdin: StdinFn,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
@ -96,6 +98,12 @@ config-stdin will consume stdin until the channel is closed via. EOF"
|
||||
config_stdin: bool,
|
||||
}
|
||||
|
||||
impl Default for Command {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Command {
|
||||
pub fn new() -> Self {
|
||||
let args = std::env::args();
|
||||
@ -256,10 +264,8 @@ impl Command {
|
||||
self.ui.write_str_ln(&format!("OK: {}", stdout));
|
||||
}
|
||||
Err(e) => {
|
||||
self.ui.write_str_ln(&format!(
|
||||
"WARNING: git is not installed: {}",
|
||||
e
|
||||
));
|
||||
self.ui
|
||||
.write_str_ln(&format!("WARNING: git is not installed: {}", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,7 +401,7 @@ impl Command {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_git(&self, current_dir: &PathBuf) -> anyhow::Result<VcsClient> {
|
||||
fn get_git(&self, current_dir: &Path) -> anyhow::Result<VcsClient> {
|
||||
if self.global.no_vcs {
|
||||
Ok(VcsClient::new_noop())
|
||||
} else {
|
||||
@ -490,8 +496,7 @@ pub struct PleaseSettingsConfig {
|
||||
pub api_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct PleaseConfig {
|
||||
pub project: Option<PleaseProjectConfig>,
|
||||
pub settings: Option<PleaseSettingsConfig>,
|
||||
@ -507,8 +512,6 @@ impl PleaseConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
struct CuddleEmbeddedPleaseConfig {
|
||||
please: PleaseConfig,
|
||||
@ -558,7 +561,7 @@ fn get_config(current_dir: &Path, stdin: Option<String>) -> anyhow::Result<Pleas
|
||||
Ok(please_config)
|
||||
}
|
||||
|
||||
fn get_config_from_file<'d, T>(current_cuddle_path: PathBuf) -> Option<PleaseConfig>
|
||||
fn get_config_from_file<T>(current_cuddle_path: PathBuf) -> Option<PleaseConfig>
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
T: Into<PleaseConfig>,
|
||||
|
Loading…
Reference in New Issue
Block a user