Skip to content

Commit cd1a206

Browse files
authored
Merge pull request #6170 from epage/stable
docs: Fix link
2 parents bb886ac + a89f3e6 commit cd1a206

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

clap_builder/src/builder/arg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ impl Arg {
492492
///
493493
/// <div class="warning">
494494
///
495-
/// **NOTE:** When utilized with [`Arg::num_args(1..)`], only the **last** positional argument
495+
/// **NOTE:** When utilized with [`Arg::num_args(1..)`][Arg::num_args], only the **last** positional argument
496496
/// may be defined as having a variable number of arguments (i.e. with the highest index)
497497
///
498498
/// </div>
@@ -1359,7 +1359,7 @@ impl Arg {
13591359
///
13601360
/// <div class="warning">
13611361
///
1362-
/// **NOTE:** implicitly sets [`Arg::action(ArgAction::Set)`].
1362+
/// **NOTE:** implicitly sets [`Arg::action(ArgAction::Set)`][ArgAction::Set].
13631363
///
13641364
/// </div>
13651365
///
@@ -1487,7 +1487,7 @@ impl Arg {
14871487
///
14881488
/// **WARNING:** Prior arguments with `allow_hyphen_values(true)` get precedence over known
14891489
/// flags but known flags get precedence over the next possible positional argument with
1490-
/// `allow_hyphen_values(true)`. When combined with [`Arg::num_args(..)`],
1490+
/// `allow_hyphen_values(true)`. When combined with [`Arg::num_args(..)`][Arg::num_args],
14911491
/// [`Arg::value_terminator`] is one way to ensure processing stops.
14921492
///
14931493
/// </div>

clap_builder/src/error/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub enum ErrorKind {
224224
/// Occurs when the user provides a value containing invalid UTF-8.
225225
///
226226
/// To allow arbitrary data
227-
/// - Set [`Arg::value_parser(value_parser!(OsString))`] for argument values
227+
/// - Set [`Arg::value_parser(value_parser!(OsString))`][crate::Arg::value_parser] for argument values
228228
/// - Set [`Command::external_subcommand_value_parser`] for external-subcommand
229229
/// values
230230
///

clap_builder/src/util/color.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::builder::PossibleValue;
22
use crate::derive::ValueEnum;
33

44
/// Represents the color preferences for program output
5-
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
5+
#[derive(Debug, Copy, Clone, Eq, PartialEq, Default)]
66
pub enum ColorChoice {
77
/// Enables colored output only when the output is going to a terminal or TTY.
88
///
@@ -23,6 +23,7 @@ pub enum ColorChoice {
2323
/// .get_matches();
2424
/// # }
2525
/// ```
26+
#[default]
2627
Auto,
2728

2829
/// Enables colored output regardless of whether or not the output is going to a terminal/TTY.
@@ -65,12 +66,6 @@ impl ColorChoice {
6566
}
6667
}
6768

68-
impl Default for ColorChoice {
69-
fn default() -> Self {
70-
Self::Auto
71-
}
72-
}
73-
7469
impl std::fmt::Display for ColorChoice {
7570
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7671
self.to_possible_value()

examples/tutorial_builder/04_04_custom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
)
3838
.exit();
3939
}
40-
ver.to_string()
40+
ver.clone()
4141
} else {
4242
// Increment the one requested (in a real program, we'd reset the lower numbers)
4343
let (maj, min, pat) = (

tests/derive/value_enum.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ fn basic() {
4141
#[test]
4242
fn default_value() {
4343
#[derive(clap::ValueEnum, PartialEq, Debug, Clone)]
44+
#[derive(Default)]
4445
enum ArgChoice {
4546
Foo,
47+
#[default]
4648
Bar,
4749
}
4850

49-
impl Default for ArgChoice {
50-
fn default() -> Self {
51-
Self::Bar
52-
}
53-
}
51+
5452

5553
#[derive(Parser, PartialEq, Debug)]
5654
struct Opt {

0 commit comments

Comments
 (0)