1 #[warn(clippy::cmp_owned)]
2 #[allow(clippy::unnecessary_operation)]
4 fn with_to_string(x: &str) {
5 x != "foo".to_string();
7 "foo".to_string() != x;
14 x != "foo".to_owned();
16 x != String::from("foo");
18 42.to_string() == "42";
20 Foo.to_owned() == Foo;
22 "abc".chars().filter(|c| c.to_owned() != 'X');
24 "abc".chars().filter(|c| *c != 'X');
39 impl PartialEq for Foo {
40 fn eq(&self, other: &Self) -> bool {
41 self.to_owned() == *other
45 impl ToOwned for Foo {
47 fn to_owned(&self) -> Bar {
55 impl PartialEq<Foo> for Bar {
56 fn eq(&self, _: &Foo) -> bool {
61 impl std::borrow::Borrow<Foo> for Bar {
62 fn borrow(&self) -> &Foo {
63 static FOO: Foo = Foo;
71 impl ToOwned for Baz {
73 fn to_owned(&self) -> Baz {