Skip to content

Commit 0ad7787

Browse files
authored
Merge pull request #6120 from epage/error
fix(derive): Match rustc's error style
2 parents d045daa + 92fd6e7 commit 0ad7787

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

clap_derive/src/derives/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,13 +735,13 @@ fn gen_parsers(
735735
Name::Assigned(_) => {
736736
quote_spanned! { ty.span()=>
737737
#arg_matches.#get_one(#id)
738-
.ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, format!("The following required argument was not provided: {}", #id)))?
738+
.ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, format!("the following required argument was not provided: {}", #id)))?
739739
}
740740
}
741741
Name::Derived(_) => {
742742
quote_spanned! { ty.span()=>
743743
#arg_matches.#get_one(#id)
744-
.ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, concat!("The following required argument was not provided: ", #id)))?
744+
.ok_or_else(|| clap::Error::raw(clap::error::ErrorKind::MissingRequiredArgument, concat!("the following required argument was not provided: ", #id)))?
745745
}
746746
}
747747
}

clap_derive/src/derives/subcommand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ fn gen_from_arg_matches(variants: &[(&Variant, Item)]) -> Result<TokenStream, sy
548548
},
549549

550550
None => quote! {
551-
::std::result::Result::Err(clap::Error::raw(clap::error::ErrorKind::InvalidSubcommand, format!("The subcommand '{}' wasn't recognized", #subcommand_name_var)))
551+
::std::result::Result::Err(clap::Error::raw(clap::error::ErrorKind::InvalidSubcommand, format!("the subcommand '{}' wasn't recognized", #subcommand_name_var)))
552552
},
553553
};
554554

@@ -565,7 +565,7 @@ fn gen_from_arg_matches(variants: &[(&Variant, Item)]) -> Result<TokenStream, sy
565565

566566
#wildcard
567567
} else {
568-
::std::result::Result::Err(clap::Error::raw(clap::error::ErrorKind::MissingSubcommand, "A subcommand is required but one was not provided."))
568+
::std::result::Result::Err(clap::Error::raw(clap::error::ErrorKind::MissingSubcommand, "a subcommand is required but one was not provided"))
569569
}
570570
}
571571
})

examples/derive_ref/interop_tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For more information, try '--help'.
4848
```console
4949
$ interop_augment_subcommands
5050
? failed
51-
error: A subcommand is required but one was not provided.
51+
error: a subcommand is required but one was not provided
5252
```
5353

5454
```console

tests/derive/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn derive_generated_error_has_full_context() {
221221
);
222222

223223
let expected = str![[r#"
224-
error: The following required argument was not provided: req_str
224+
error: the following required argument was not provided: req_str
225225
226226
Usage: clap --req-str <REQ_STR>
227227
clap <COMMAND>

0 commit comments

Comments
 (0)