We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error
This lint lints against local types which are used as a Result's E type, but don't implement the Error trait.
Result
E
missing_error_impls
style, pedantic, or restriction
dyn Error
impl Error
?
Result<_, Box<dyn Error>>
anyhow::Result<_>
thiserror
no_std
error_in_core
pub struct MyError; pub fn foo() -> Result<(), MyError> { Ok(()) }
Could be written as:
#[derive(Debug)] pub struct MyError; impl std::error::Error for MyError {} impl std::fmt::Display for MyError { fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() } } pub fn foo() -> Result<(), MyError> { Ok(()) }
Or as:
#[derive(Debug, thiserror::Error)] #[error("todo")] pub struct MyError; pub fn foo() -> Result<(), MyError> { Ok(()) }
The text was updated successfully, but these errors were encountered:
Same as #6409?
Sorry, something went wrong.
Seems like it; my bad 😅
No branches or pull requests
What it does
This lint lints against local types which are used as a
Result
'sE
type, but don't implement theError
trait.Lint Name
missing_error_impls
Category
style, pedantic, or restriction
Advantage
dyn Error
/impl Error
?
on theResult
type in functions/try blocks that returnResult<_, Box<dyn Error>>
oranyhow::Result<_>
Drawbacks
thiserror
)no_std
,Error
is only available with theerror_in_core
feature gateExample
Could be written as:
Or as:
The text was updated successfully, but these errors were encountered: