]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/deref_addrof.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / deref_addrof.rs
index be7cc669b5b6daf3c0cb855d6fe861e7920e943e..49f360b9a7f9e2ca7f7d6275d69f546f764b41d9 100644 (file)
@@ -1,4 +1,5 @@
 // run-rustfix
+#![allow(clippy::return_self_not_must_use)]
 #![warn(clippy::deref_addrof)]
 
 fn get_number() -> usize {
@@ -36,6 +37,8 @@ fn main() {
     let b = *&&a;
 
     let b = **&aref;
+
+    let _ = unsafe { *core::ptr::addr_of!(a) };
 }
 
 #[rustfmt::skip]
@@ -52,12 +55,14 @@ macro_rules! m_mut {
     };
 }
 
+#[derive(Copy, Clone)]
 pub struct S;
 impl S {
     pub fn f(&self) -> &Self {
         m!(self)
     }
-    pub fn f_mut(&self) -> &Self {
+    #[allow(unused_mut)] // mut will be unused, once the macro is fixed
+    pub fn f_mut(mut self) -> Self {
         m_mut!(self)
     }
 }