- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
Open
Labels
A-lintArea: New lintsArea: New lints
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()
}Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints