Existing linters, type-checker configuration or other tooling to identify unused Results?
See original GitHub issueI’m rather fond of the promise of this library in my type-annotated codebase. I already type-check it with Pyright. However, it seems easy to accidentally miss a returned Result
if the method otherwise returns None
. i.e., if I care about the value in case of success, I’ll surely get a type error in the case that I fail to check for error variants; if I don’t, then I might not be warned about the Result
being there at all.
This seems like it would be a common problem for projects using this crate. Is there a well-understood solution already? Perhaps other type-checkers can catch unused return values (like Rust does with #[must_use]
), or linters/linter plugins which would provide such functionality. I see issues considering adding this to mypy but they remain open and unimplemented.
What do others do? Is the best solution solution to only use Result
when I have a value to return in the success case?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
We’d welcome your feedback and experience if you end up playing around with that. Let us know so we can possibly update the README here for overall better user experience with this library.
That’s exactly what I was looking for; evidently, my Ctrl+F attempt was very poorly executed! I saw the mypy thread but missed the reference to Pyright, and I guess didn’t use the right terms in their actual docs. It works great.
Thank you!