style: Make clippy happy

This commit is contained in:
Ed Page
2025-10-31 13:47:50 -05:00
parent bb886acc78
commit 667ead6e59
3 changed files with 6 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ use crate::builder::PossibleValue;
use crate::derive::ValueEnum;
/// Represents the color preferences for program output
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Default)]
pub enum ColorChoice {
/// Enables colored output only when the output is going to a terminal or TTY.
///
@@ -23,6 +23,7 @@ pub enum ColorChoice {
/// .get_matches();
/// # }
/// ```
#[default]
Auto,
/// Enables colored output regardless of whether or not the output is going to a terminal/TTY.
@@ -65,12 +66,6 @@ impl ColorChoice {
}
}
impl Default for ColorChoice {
fn default() -> Self {
Self::Auto
}
}
impl std::fmt::Display for ColorChoice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.to_possible_value()

View File

@@ -37,7 +37,7 @@ fn main() {
)
.exit();
}
ver.to_string()
ver.clone()
} else {
// Increment the one requested (in a real program, we'd reset the lower numbers)
let (maj, min, pat) = (

View File

@@ -41,16 +41,14 @@ fn basic() {
#[test]
fn default_value() {
#[derive(clap::ValueEnum, PartialEq, Debug, Clone)]
#[derive(Default)]
enum ArgChoice {
Foo,
#[default]
Bar,
}
impl Default for ArgChoice {
fn default() -> Self {
Self::Bar
}
}
#[derive(Parser, PartialEq, Debug)]
struct Opt {