-
Notifications
You must be signed in to change notification settings - Fork 150
Emit dummy StructOpt impl when reporting errors #240
Copy link
Copy link
Closed
Labels
enhancementWe would love to have this feature! Feel free to supply a PRWe would love to have this feature! Feel free to supply a PR
Description
Currently when structopt-derive reports an error, only the compile_error is emitted. That means the author will see both the compile_error and most likely an error about a missing StructOpt impl.
error: `CARGO_PKG_VERSION` environment variable is not defined, use `version = "version" to set it manually or `no_version` to not set it at all
--> src/main.rs:5:10
|
5 | #[derive(StructOpt, Debug)]
| ^^^^^^^^^
error[E0599]: no function or associated item named `from_args` found for type `Opt` in the current scope
--> src/main.rs:44:20
|
7 | struct Opt {
| ---------- function or associated item `from_args` not found for this
...
44 | let opt = Opt::from_args();
| ^^^^^^^^^ function or associated item not found in `Opt`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `from_args`, perhaps you need to implement it:
candidate #1: `structopt::StructOpt`
error: aborting due to 2 previous errorsIt would be nicer to emit a dummy StructOpt impl in addition to the error. Nothing in the impl will be called because the crate doesn't compile from the compile_error, but this way the author gets less useless errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementWe would love to have this feature! Feel free to supply a PRWe would love to have this feature! Feel free to supply a PR