mirror of
https://github.com/orhun/git-cliff.git
synced 2025-01-05 22:54:48 +03:00
refactor(clippy): apply clippy suggestions
This commit is contained in:
parent
b88e7d30be
commit
cd018e90a1
@ -197,10 +197,7 @@ impl Serialize for Commit<'_> {
|
||||
commit.serialize_field("breaking", &conv.breaking())?;
|
||||
commit.serialize_field(
|
||||
"scope",
|
||||
&conv
|
||||
.scope()
|
||||
.map(|v| v.as_str())
|
||||
.or_else(|| self.scope.as_deref()),
|
||||
&conv.scope().map(|v| v.as_str()).or(self.scope.as_deref()),
|
||||
)?;
|
||||
}
|
||||
None => {
|
||||
|
@ -21,7 +21,7 @@ impl EmbeddedConfig {
|
||||
/// Extracts the embedded content.
|
||||
pub fn get_config() -> Result<String> {
|
||||
match Self::get(crate::DEFAULT_CONFIG) {
|
||||
Some(v) => Ok(str::from_utf8(&v.data.into_owned())?.to_string()),
|
||||
Some(v) => Ok(str::from_utf8(&v.data)?.to_string()),
|
||||
None => Err(Error::EmbeddedError(String::from(
|
||||
"Embedded config not found",
|
||||
))),
|
||||
|
@ -119,8 +119,7 @@ impl Repository {
|
||||
if let Some(commit) = tag
|
||||
.target()
|
||||
.ok()
|
||||
.map(|target| target.into_commit().ok())
|
||||
.flatten()
|
||||
.and_then(|target| target.into_commit().ok())
|
||||
{
|
||||
tags.push((commit, name));
|
||||
}
|
||||
|
@ -56,8 +56,7 @@ pub fn run(mut args: Opt) -> Result<()> {
|
||||
}?;
|
||||
if let Some(config_path) = dirs_next::config_dir()
|
||||
.map(|dir| dir.join(env!("CARGO_PKG_NAME")).join(DEFAULT_CONFIG))
|
||||
.map(|path| path.to_str().map(String::from))
|
||||
.flatten()
|
||||
.and_then(|path| path.to_str().map(String::from))
|
||||
{
|
||||
if fs::metadata(&config_path).is_ok() {
|
||||
path = config_path;
|
||||
|
Loading…
Reference in New Issue
Block a user