- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
We're incorrectly suggesting wrapping with Ok() when it won't help:
error[E0308]: try expression alternatives have incompatible types
   -->
    |
503 | /   segments
504 | |     .next()
505 | |     .ok_or(ApplicationIssue::InvalidMessage(foo::Error::InvalidHeader))?
    | |________________________________________________________________________^ expected struct `failure::Error`, found enum `foo::Error`
    |
    = note: expected type `std::result::Result<_, failure::Error>`
               found type `std::result::Result<_, foo::Error>`
help: try wrapping with a success variant
    |
503 |   Ok(segments
504 |     .next()
505 |     .ok_or(ApplicationIssue::InvalidMessage(foo::Error::InvalidHeader))?)
It should be suggesting using using map_err instead.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints