error_chain's Result<T> support
See original GitHub issueWhen using the error_chain crate it’s common to define the errors in a “errors.rs” mod and import them where needed with use errors::*
.
This overrides the default Result<T,E>
enum with a Result<T>
, and intellij-rust reports all the functions using it as errors (Wrong number of arguments: expected 2, found 1 [E0243]).
I know it’s hard to parse macros (see #955), but I was wondering if there is a way to use annotations to declare the definition of enums, structs or functions (like // @defines Result<T>
or similar) to use in the mod defining them, so that the parser recognizes them.
P.S.: sorry for the empty bug report earlier, I don’t know what I pressed to post it while writing… 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:19
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Crate error_chain - Docs.rs
Introducing new error chains, with a string message: fn foo() -> Result<()> ... error-chain supports extending an error chain by appending new errors....
Read more >Concatentating error chains · Issue #93 · dtolnay/anyhow
I have a program that has several mechanisms that it can use to accomplish its task; they are attempted in order from most...
Read more >Crate error_chain - Rust
Introducing new error chains, with a string message: fn foo() -> Result<()> ... error-chain supports extending an error chain by appending new errors....
Read more >errors package - github.com/signalfx/golib/v2/errors - Go Packages
Note returns error rather than *ErrorChain so that it matches errors. ... PanicIfErrWrite is similar to PanicIfErr, but works well with io results...
Read more >Sending MDM Commands to a Device - Apple Developer
Execute commands on a device and receive responses that contain the results of each operation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, we definitely should do this with perhaps most of the errors: combination of macros and shadowing leads to false positives 😦
Special casing
error_chain!
would be a nice addition!I’ve been using this as a workaround, if anyone else is interested:
https://github.com/FauxFaux/error-chain-for-dumb-ides#error-chain-for-dumb-ides