3 #[warn(clippy::cmp_owned)]
4 #[allow(clippy::unnecessary_operation, clippy::no_effect, unused_must_use, clippy::eq_op)]
6 fn with_to_string(x: &str) {
20 42.to_string() == "42";
24 "abc".chars().filter(|c| *c != 'X');
26 "abc".chars().filter(|c| *c != 'X');
31 impl PartialEq for Foo {
32 // Allow this here, because it emits the lint
33 // without a suggestion. This is tested in
34 // `tests/ui/cmp_owned/without_suggestion.rs`
35 #[allow(clippy::cmp_owned)]
36 fn eq(&self, other: &Self) -> bool {
37 self.to_owned() == *other
41 impl ToOwned for Foo {
43 fn to_owned(&self) -> Bar {
48 #[derive(PartialEq, Eq)]
51 impl PartialEq<Foo> for Bar {
52 fn eq(&self, _: &Foo) -> bool {
57 impl std::borrow::Borrow<Foo> for Bar {
58 fn borrow(&self) -> &Foo {
59 static FOO: Foo = Foo;
64 #[derive(PartialEq, Eq)]
67 impl ToOwned for Baz {
69 fn to_owned(&self) -> Baz {