Skip to content

Supports let-chains in manual_strip #15818

@ada4a

Description

@ada4a

Currently, the lint doesn't flag code like this:

#![warn(clippy::manual_strip)]

fn some_check() -> bool { todo!() }

fn foo(s: &str) {
    if s.starts_with("ab")
        && let stripped = &s["ab".len()..]
        && some_check() // to avoid `irrefutable_let_patterns`
    {
        //
    }
}

It would be cool if it would.

I think checking only consecutive ifs is fine.

@rustbot label C-enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions