2023-04-23 13:03:09 +02:00
|
|
|
//@run-rustfix
|
2022-01-17 13:29:07 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|