Repository: clap-rs/clap (language: rust)

Issue:
Derive API broken in 4.0.0
### Please complete the following tasks

- [X] I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
- [X] I have searched the [open](https://github.com/clap-rs/clap/issues) and [rejected](https://github.com/clap-rs/clap/issues?q=is%3Aissue+label%3AS-wont-fix+is%3Aclosed) issues

### Rust Version

rustc 1.64.0 (a55dd71d5 2022-09-19)

### Clap Version

4.0.0

### Minimal reproducible code

Just copy the official example from https://docs.rs/clap/latest/clap/#example:

```rust
use clap::Parser;

/// Simple program to greet a person
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
   /// Name of the person to greet
   #[clap(short, long, value_parser)]
   name: String,

   /// Number of times to greet
   #[clap(short, long, value_parser, default_value_t = 1)]
   count: u8,
}

fn main() {
   let args = Args::parse();

   for _ in 0..args.count {
       println!("Hello {}!", args.name)
   }
}
```


### Steps to reproduce the bug with the above code

- `cargo new clap40test`
- copy code into `src/main.rs`
- `cargo add clap -F derive`
- `cargo check`

### Actual Behaviour

```
error: Unknown `#[clap(author)]` attribute (`#[command(author)] exists)
 --> src/main.rs:5:8
  |
5 | #[clap(author, version, about, long_about = None)]
  |        ^^^^^^

error: could not compile `clap40test` due to previous error
```

If I remove `author`, it claims about `version`. And if I remove `version`, it complains about `about` and so on.

### Expected Behaviour

- Official example compiles
- Derive API works

### Additional Context

_No response_

### Debug Output

```
error: Unknown `#[clap(version)]` attribute (`#[command(version)] exists)
 --> src/main.rs:5:8
  |
5 | #[clap(version, about, long_about = None)]
  |        ^^^^^^^

error: could not compile `clap40test` due to previous error
```


Discussion / hints:

Fix patch:
diff --git a/clap_derive/src/item.rs b/clap_derive/src/item.rs
index 627d11b52e1..758df901a37 100644
--- a/clap_derive/src/item.rs
+++ b/clap_derive/src/item.rs
@@ -1261,10 +1261,12 @@ impl ToTokens for Deprecation {
 }
 
 fn assert_attr_kind(attr: &ClapAttr, possible_kind: &[AttrKind]) {
-    if !possible_kind.contains(attr.kind.get()) {
+    if *attr.kind.get() == AttrKind::Clap || *attr.kind.get() == AttrKind::StructOpt {
+        // deprecated
+    } else if !possible_kind.contains(attr.kind.get()) {
         let options = possible_kind
             .iter()
-            .map(|k| format!("`#[{}({})]", k.as_str(), attr.name))
+            .map(|k| format!("`#[{}({})]`", k.as_str(), attr.name))
             .collect::<Vec<_>>();
         abort!(
             attr.name,


Test patch: