X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tests%2Fui%2Fneedless_borrow.rs;h=3ae4722a1f8985e414ea3a9d49f85ccb397bf770;hb=afb34eb261aa8e54b9045a582d2553bb7d6fd463;hp=d636a40100378c0f5bebc5cbb3f85b9f902ab365;hpb=2d0195986c6695c63db73ddf20bcd69a9642a189;p=rust.git diff --git a/tests/ui/needless_borrow.rs b/tests/ui/needless_borrow.rs index d636a401003..3ae4722a1f8 100644 --- a/tests/ui/needless_borrow.rs +++ b/tests/ui/needless_borrow.rs @@ -115,6 +115,18 @@ impl FooRef for &'_ () { fn foo_ref(&self) {} } (&&()).foo_ref(); // Don't lint. `&()` will call `<() as FooRef>::foo_ref` + + struct S; + impl From for u32 { + fn from(s: S) -> Self { + (&s).into() + } + } + impl From<&S> for u32 { + fn from(s: &S) -> Self { + 0 + } + } } #[allow(clippy::needless_borrowed_reference)]