dtolnay / no-panic

Attribute macro to require that the compiler prove a function can't ever panic
Apache License 2.0
1k stars 13 forks source link

Do a parse as Nothing to check empty args #29

Closed dtolnay closed 2 years ago

dtolnay commented 2 years ago

Before:

error: custom attribute panicked
   --> src/lib.rs:292:1
    |
292 | #[no_panic(asdf)]
    | ^^^^^^^^^^^^^^^^^
    |
    = help: message: assertion failed: args.is_empty()

After:

error: unexpected token
   --> src/lib.rs:292:12
    |
292 | #[no_panic(asdf)]
    |            ^^^^