]> git.lizzy.rs Git - rust.git/commitdiff
Add known problem to `needless_borrow` lint
authorChristian Duerr <contact@christianduerr.com>
Wed, 25 Jul 2018 12:54:09 +0000 (14:54 +0200)
committerChristian Duerr <contact@christianduerr.com>
Wed, 25 Jul 2018 12:54:09 +0000 (14:54 +0200)
The `needless_borrow` lint is temporarily disabled because of some false
positives it causes in combination with the `derive` macro.

However the documentation does not explain these issues, but instead
lists `Known problems: None`. To make it clear why this lint is
currently not enabled, a description of the false positives caused by
this lint has been added to the `Known problems` section.

clippy_lints/src/needless_borrow.rs

index 7986b43919c80fbf70417cffd962eb95967f5dfc..cb2c572743db87831c23b9690b5544028043927c 100644 (file)
 /// **Why is this bad?** Suggests that the receiver of the expression borrows
 /// the expression.
 ///
-/// **Known problems:** None.
-///
 /// **Example:**
 /// ```rust
 /// let x: &i32 = &&&&&&5;
 /// ```
+///
+/// **Known problems:** This will cause false positives in code generated by `derive`.
+/// For instance in the following snippet:
+/// ```rust
+/// #[derive(Debug)]
+/// pub enum Error {
+///     Type(
+///         &'static str,
+///     ),
+/// }
+/// ```
+/// A warning will be emitted that `&'static str` should be replaced with `&'static str`,
+/// however there is nothing that can or should be done to fix this.
 declare_clippy_lint! {
     pub NEEDLESS_BORROW,
     nursery,