mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
28 lines
401 B
Rust
28 lines
401 B
Rust
|
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
|
||
|
}
|
||
|
}
|