summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/cmp_owned/comparison_flip.fixed
blob: 44e41bdd1148711497a4d8a7928b3650a919e557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// run-rustfix

use std::fmt::{self, Display};

fn main() {
    let a = Foo;

    if a != "bar" {
        println!("foo");
    }

    if a != "bar" {
        println!("foo");
    }
}

struct Foo;

impl Display for Foo {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "foo")
    }
}

impl PartialEq<&str> for Foo {
    fn eq(&self, other: &&str) -> bool {
        "foo" == *other
    }
}