Open
Description
What it does
Detect when map_err
maps from error type E
to error type E
. In those situations the mapping is redundant
Advantage
- this is like a redundant operation
- mapping the error one from enum variant to another is likely not what people intend in most cases
Drawbacks
No response
Example
enum Error {
A,
B
}
fn source() -> Result<(), Error> { Err(Error::A) }
fn main() -> Result<(), Error> {
source().map_err(|_| Error::A)
}
Could be written as:
fn main() -> Result<(), Error> {
source()
}