mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Fix the external command subtype check
This commit is contained in:
parent
81457178fa
commit
081f3e865c
2 changed files with 13 additions and 10 deletions
|
@ -188,12 +188,18 @@ fn gen_from_subcommand(
|
|||
quote!(::std::string::String),
|
||||
quote!(values_of),
|
||||
)
|
||||
} else {
|
||||
} else if is_simple_ty(subty, "OsString") {
|
||||
(
|
||||
subty.span(),
|
||||
quote!(::std::ffi::OsString),
|
||||
quote!(values_of_os),
|
||||
)
|
||||
} else {
|
||||
abort!(
|
||||
ty.span(),
|
||||
"The type must be either `Vec<String>` or `Vec<OsString>` \
|
||||
to be used with `external_subcommand`."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: The type must be either `Vec<String>` or `Vec<OsString>` to be used with `external_subcommand`.
|
||||
--> $DIR/external_subcommand_wrong_type.rs:7:11
|
||||
|
|
||||
7 | Other(Vec<CString>),
|
||||
| ^^^
|
||||
|
||||
error: The type must be either `Vec<String>` or `Vec<OsString>` to be used with `external_subcommand`.
|
||||
--> $DIR/external_subcommand_wrong_type.rs:13:11
|
||||
|
|
||||
|
@ -10,12 +16,3 @@ error: The enum variant marked with `external_attribute` must be a single-typed
|
|||
18 | / #[clap(external_subcommand)]
|
||||
19 | | Other { a: String },
|
||||
| |_______________________^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/external_subcommand_wrong_type.rs:7:15
|
||||
|
|
||||
7 | Other(Vec<CString>),
|
||||
| ^^^^^^^ expected struct `std::ffi::CString`, found struct `std::ffi::OsString`
|
||||
|
|
||||
= note: expected struct `std::vec::Vec<std::ffi::CString>`
|
||||
found struct `std::vec::Vec<std::ffi::OsString>`
|
||||
|
|
Loading…
Reference in a new issue