Skip to content

op_ref false positive with deref coercions when comparing #2597

Open

Description

Perhaps related to #2042, but it seemed different enough to open a new issue.

With the following code: https://play.rust-lang.org/?gist=35d367db95cd56394d0bb9a05247b94c&version=nightly

fn main() {
    let a: &str = "abc";
    let b: String = "abc".to_owned();
    println!("{}", a > &b);
}

Clippy complains that the reference should be removed, but removing the reference causes the code to stop compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsL-testsLint: Lints test codegood-first-issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions