mirror of
https://github.com/clap-rs/clap.git
synced 2026-01-25 05:36:19 +00:00
style: Make clippy happy
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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) = (
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user