mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-11 22:02:55 +00:00
Merge pull request #2959 from chrisduerr/master
Add known problem to `needless_borrow` lint
This commit is contained in:
commit
0aeb82cb67
1 changed files with 13 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue