Merge pull request #2959 from chrisduerr/master

Add known problem to `needless_borrow` lint
This commit is contained in:
Philipp Hansch 2018-07-29 12:15:17 +02:00 committed by GitHub
commit 0aeb82cb67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,12 +16,23 @@ use crate::utils::{in_macro, snippet_opt, span_lint_and_then};
/// **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,