mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
fix(derive): Disallow general attributes with from_global
This commit is contained in:
parent
a71b2eb8b8
commit
222003abe1
1 changed files with 9 additions and 2 deletions
|
@ -786,8 +786,8 @@ impl Item {
|
|||
}
|
||||
}
|
||||
|
||||
if let Kind::Skip(_, attr) = &*self.kind {
|
||||
if self.has_explicit_methods() {
|
||||
if self.has_explicit_methods() {
|
||||
if let Kind::Skip(_, attr) = &*self.kind {
|
||||
abort!(
|
||||
self.methods[0].name.span(),
|
||||
"`{}` cannot be used with `#[{}(skip)]",
|
||||
|
@ -795,6 +795,13 @@ impl Item {
|
|||
attr.as_str(),
|
||||
);
|
||||
}
|
||||
if let Kind::FromGlobal(_) = &*self.kind {
|
||||
abort!(
|
||||
self.methods[0].name.span(),
|
||||
"`{}` cannot be used with `#[arg(from_global)]",
|
||||
self.methods[0].name,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue