]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/borrow_deref_ref.rs
Auto merge of #9870 - koka831:unformat-unused-rounding, r=Jarcho
[rust.git] / clippy_lints / src / borrow_deref_ref.rs
index ec2f31cf6737415184740ec6be5cc6fdac9aaab7..c4520d003928e3832053fe749045c643407ed2c1 100644 (file)
     /// Dereferencing and then borrowing a reference value has no effect in most cases.
     ///
     /// ### Known problems
-    /// false negative on such code:
+    /// False negative on such code:
     /// ```
     /// let x = &12;
     /// let addr_x = &x as *const _ as usize;
-    /// let addr_y = &&*x as *const _ as usize; // assert ok now, and lint triggerd.
+    /// let addr_y = &&*x as *const _ as usize; // assert ok now, and lint triggered.
     ///                                         // But if we fix it, assert will fail.
     /// assert_ne!(addr_x, addr_y);
     /// ```
     /// ```rust
     /// let s = &String::new();
     ///
-    /// // Bad
     /// let a: &String = &* s;
-    /// foo(&*s);
+    /// ```
     ///
-    /// // Good
+    /// Use instead:
+    /// ```rust
+    /// # let s = &String::new();
     /// let a: &String = s;
-    /// foo(&**s);
-    ///
-    /// fn foo(_: &str){ }
     /// ```
-    #[clippy::version = "1.59.0"]
+    #[clippy::version = "1.63.0"]
     pub BORROW_DEREF_REF,
     complexity,
     "deref on an immutable reference returns the same type as itself"