diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/explicit_auto_deref.fixed')
-rw-r--r-- | src/tools/clippy/tests/ui/explicit_auto_deref.fixed | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/tools/clippy/tests/ui/explicit_auto_deref.fixed b/src/tools/clippy/tests/ui/explicit_auto_deref.fixed index 71a5ed96d..12158d0d1 100644 --- a/src/tools/clippy/tests/ui/explicit_auto_deref.fixed +++ b/src/tools/clippy/tests/ui/explicit_auto_deref.fixed @@ -1,5 +1,3 @@ -//@run-rustfix - #![feature(closure_lifetime_binder)] #![warn(clippy::explicit_auto_deref)] #![allow( @@ -207,7 +205,7 @@ fn main() { } } - f_str(&&ref_str); // `needless_borrow` will suggest removing both references + f_str(&ref_str); // `needless_borrow` will suggest removing both references f_str(&ref_str); // `needless_borrow` will suggest removing only one reference let x = &&40; @@ -295,4 +293,32 @@ fn main() { fn return_dyn_assoc<'a>(x: &'a &'a u32) -> &'a <&'a u32 as WithAssoc>::Assoc { *x } + + // Issue #11366 + let _: &mut u32 = match &mut Some(&mut 0u32) { + Some(x) => x, + None => panic!(), + }; + + // Issue #11474 + pub struct Variant { + pub anonymous: Variant0, + } + + pub union Variant0 { + pub anonymous: std::mem::ManuallyDrop<Variant00>, + } + + pub struct Variant00 { + pub anonymous: Variant000, + } + + pub union Variant000 { + pub val: i32, + } + + unsafe { + let mut p = core::mem::zeroed::<Variant>(); + (*p.anonymous.anonymous).anonymous.val = 1; + } } |