argh icon indicating copy to clipboard operation
argh copied to clipboard

Unrecognized argument on raw identifier

Open dmgolembiowski opened this issue 4 years ago • 0 comments

Demo

use argh::FromArgs;

/// An example CLI application
#[derive(FromArgs)]
struct Example {
    /// the type (as a usize) to be used
    #[argh(option)]
    r#type: usize,
}

fn main() {
    let _up: Example = argh::from_env();
}

then folllowing cargo run -- --type 1 the output is:

warning: field is never read: `type`
 --> src/main.rs:8:5
  |
8 |     r#type: usize,
  |     ^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `arghtest` (bin "arghtest") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.33s
     Running `target/debug/arghtest --type 1`
Unrecognized argument: --type

dmgolembiowski avatar Mar 09 '22 05:03 dmgolembiowski