]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/cmp_owned/without_suggestion.rs
1 #[allow(clippy::unnecessary_operation)]
2 #[allow(clippy::implicit_clone)]
8 //~^ ERROR: this creates an owned instance just for comparison
9 //~| NOTE: `-D clippy::cmp-owned` implied by `-D warnings`
14 //~^ ERROR: this creates an owned instance just for comparison
17 let y
= U32Wrapper(x
);
18 let _
= U32Wrapper
::from(x
) == y
;
23 impl PartialEq
for Foo
{
24 fn eq(&self, other
: &Self) -> bool
{
25 self.to_owned() == *other
26 //~^ ERROR: this creates an owned instance just for comparison
30 impl ToOwned
for Foo
{
32 fn to_owned(&self) -> Bar
{
37 #[derive(PartialEq, Eq)]
40 impl ToOwned
for Baz
{
42 fn to_owned(&self) -> Baz
{
47 #[derive(PartialEq, Eq)]
50 impl PartialEq
<Foo
> for Bar
{
51 fn eq(&self, _
: &Foo
) -> bool
{
56 impl std
::borrow
::Borrow
<Foo
> for Bar
{
57 fn borrow(&self) -> &Foo
{
58 static FOO
: Foo
= Foo
;
63 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
64 struct U32Wrapper(u32);
65 impl From
<u32> for U32Wrapper
{
66 fn from(x
: u32) -> Self {
70 impl PartialEq
<u32> for U32Wrapper
{
71 fn eq(&self, other
: &u32) -> bool
{
75 impl PartialEq
<U32Wrapper
> for u32 {
76 fn eq(&self, other
: &U32Wrapper
) -> bool
{