use rustc_span::Span;
declare_clippy_lint! {
- /// **What it does:** Checks for address of operations (`&`) that are going to
+ /// ### What it does
+ /// Checks for address of operations (`&`) that are going to
/// be dereferenced immediately by the compiler.
///
- /// **Why is this bad?** Suggests that the receiver of the expression borrows
+ /// ### Why is this bad?
+ /// Suggests that the receiver of the expression borrows
/// the expression.
///
- /// **Known problems:** None.
- ///
- /// **Example:**
+ /// ### Example
/// ```rust
+ /// fn fun(_a: &i32) {}
+ ///
/// // Bad
/// let x: &i32 = &&&&&&5;
+ /// fun(&x);
///
/// // Good
/// let x: &i32 = &5;
+ /// fun(x);
/// ```
pub NEEDLESS_BORROW,
style,
}
declare_clippy_lint! {
- /// **What it does:** Checks for `ref` bindings which create a reference to a reference.
- ///
- /// **Why is this bad?** The address-of operator at the use site is clearer about the need for a reference.
+ /// ### What it does
+ /// Checks for `ref` bindings which create a reference to a reference.
///
- /// **Known problems:** None.
+ /// ### Why is this bad?
+ /// The address-of operator at the use site is clearer about the need for a reference.
///
- /// **Example:**
+ /// ### Example
/// ```rust
/// // Bad
/// let x = Some("");