use rustc_span::symbol::sym;
declare_clippy_lint! {
- /// **What it does:** Checks for usage of `&Option<&T>`.
+ /// ### What it does
+ /// Checks for usage of `&Option<&T>`.
///
- /// **Why is this bad?** Since `&` is Copy, it's useless to have a
+ /// ### Why is this bad?
+ /// Since `&` is Copy, it's useless to have a
/// reference on `Option<&T>`.
///
- /// **Known problems:** It may be irrelevant to use this lint on
+ /// ### Known problems
+ /// It may be irrelevant to use this lint on
/// public API code as it will make a breaking change to apply it.
///
- /// **Example:**
- ///
+ /// ### Example
/// ```rust,ignore
/// let x: &Option<&u32> = &Some(&0u32);
/// ```
/// ```rust,ignore
/// let x: Option<&u32> = Some(&0u32);
/// ```
+ #[clippy::version = "1.49.0"]
pub REF_OPTION_REF,
pedantic,
"use `Option<&T>` instead of `&Option<&T>`"
if let Some(res) = last.res;
if let Some(def_id) = res.opt_def_id();
- if cx.tcx.is_diagnostic_item(sym::option_type, def_id);
+ if cx.tcx.is_diagnostic_item(sym::Option, def_id);
if let Some(params) = last_path_segment(qpath).args ;
if !params.parenthesized;
if let Some(inner_ty) = params.args.iter().find_map(|arg| match arg {