Skip to content

Commit 2d57c54

Browse files
committed
Fix clippy warnings
1 parent 5dd9b40 commit 2d57c54

4 files changed

Lines changed: 8 additions & 18 deletions

File tree

src/cli/color_choice.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@ use std::str::FromStr;
66
use thiserror::Error;
77

88
/// Whether messages should use color output.
9-
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9+
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
1010
pub enum ColorChoice {
1111
/// Force color output.
1212
Always,
1313
/// Intelligently guess whether to use color output.
14+
#[default]
1415
Auto,
1516
/// Force disable color output.
1617
Never,
1718
}
1819

19-
impl Default for ColorChoice {
20-
fn default() -> Self {
21-
Self::Auto
22-
}
23-
}
24-
2520
impl fmt::Display for ColorChoice {
2621
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2722
match self {

src/context/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,14 @@ pub struct Output {
4747
}
4848

4949
/// The requested verbosity of output.
50-
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)]
50+
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd)]
5151
pub enum Verbosity {
5252
Quiet,
53+
#[default]
5354
Normal,
5455
Verbose,
5556
}
5657

57-
impl Default for Verbosity {
58-
fn default() -> Self {
59-
Self::Normal
60-
}
61-
}
62-
6358
impl Context {
6459
/// The location of the configuration directory.
6560
pub fn config_dir(&self) -> &Path {

src/lock/script.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ impl LockedConfig {
9090
let out = engine
9191
.compile(&plugin.raw)
9292
.with_context(|| {
93-
format!("failed to compile inline plugin `{}`", &plugin.name)
93+
format!("failed to compile inline plugin `{}`", plugin.name)
9494
})?
9595
.render(&engine, &data)
9696
.to_string()
9797
.with_context(|| {
98-
format!("failed to render inline plugin `{}`", &plugin.name)
98+
format!("failed to render inline plugin `{}`", plugin.name)
9999
})?;
100100
script.push_str(&out);
101101
if !out.ends_with('\n') {

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn init_config(ctx: &Context, shell: Option<Shell>, path: &Path, err: Error) ->
146146
if ctx.interactive
147147
&& !casual::confirm(format!(
148148
"Initialize new config file `{}`?",
149-
&ctx.replace_home(path).display()
149+
ctx.replace_home(path).display()
150150
))
151151
{
152152
bail!("aborted initialization!");
@@ -155,7 +155,7 @@ fn init_config(ctx: &Context, shell: Option<Shell>, path: &Path, err: Error) ->
155155
fs::create_dir_all(parent).with_context(|| {
156156
format!(
157157
"failed to create directory `{}`",
158-
&ctx.replace_home(parent).display()
158+
ctx.replace_home(parent).display()
159159
)
160160
})?;
161161
}

0 commit comments

Comments
 (0)