Skip to content

FP redundant_pattern_matching: try! macro #5504

Closed
@matthiaskrgr

Description

@matthiaskrgr

This code from serde

        fn visit_map<M>(self, mut access: M) -> Result<(), M::Error>
        where
            M: MapAccess<'de>,
        {
            while let Some(_) = try!(access.next_entry::<IgnoredAny, IgnoredAny>()) {}
            Ok(())
        }

caused the warning

warning: redundant pattern matching, consider using `is_some()`
    --> serde/src/private/de.rs:2475:23
     |
2475 |             while let Some(_) = try!(access.next_entry::<IgnoredAny, IgnoredAny>()) {}
     |                       ^^^^^^^   --------------------------------------------------- help: try this: `while _.is_some()`
     |

_.is_some() does not look like it is going to work 😄

clippy 0.0.212 (891e1a8 2020-04-18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions