Skip to content

if_same_then_else does not detect same if let expression #6702

Open
@link2xt

Description

@link2xt

Lint name: if_same_then_else

I tried this code: https://github.com/deltachat/deltachat-core-rust/blob/master/src/message.rs#L1081-L1091

                        if chat.id.is_deaddrop() {
                            if let Some(contact) = contact {
                                self.text1 = Some(msg.get_sender_name(contact));
                            } else {
                                self.text1 = None;
                            }
                        } else if let Some(contact) = contact {
                            self.text1 = Some(msg.get_sender_name(contact));
                        } else {
                            self.text1 = None;
                        }

I expected to see this happen: detect that chat.id.is_deaddrop() condition could be removed.

Instead, this happened: clippy did not detect anything.

Meta

  • cargo clippy -V: clippy 0.0.212 (e1884a8 2020-12-29)
  • rustc -Vv:
    rustc 1.49.0 (e1884a8e3 2020-12-29)
    binary: rustc
    commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
    commit-date: 2020-12-29
    host: x86_64-unknown-linux-gnu
    release: 1.49.0
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesE-hardCall for participation: This a hard problem and requires more experience or effort to work onI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions