1 #[warn(clippy::cmp_owned)]
2 #[allow(clippy::unnecessary_operation, clippy::no_effect, unused_must_use, clippy::eq_op)]
4 fn with_to_string(x: &str) {
18 42.to_string() == "42";
22 "abc".chars().filter(|c| *c != 'X');
24 "abc".chars().filter(|c| *c != 'X');
29 impl PartialEq for Foo {
30 // Allow this here, because it emits the lint
31 // without a suggestion. This is tested in
32 // `$DIR/without_suggestion.rs`
33 #[allow(clippy::cmp_owned)]
34 fn eq(&self, other: &Self) -> bool {
35 self.to_owned() == *other
39 impl ToOwned for Foo {
41 fn to_owned(&self) -> Bar {
46 #[derive(PartialEq, Eq)]
49 impl PartialEq<Foo> for Bar {
50 fn eq(&self, _: &Foo) -> bool {
55 impl std::borrow::Borrow<Foo> for Bar {
56 fn borrow(&self) -> &Foo {
57 static FOO: Foo = Foo;
62 #[derive(PartialEq, Eq)]
65 impl ToOwned for Baz {
67 fn to_owned(&self) -> Baz {