use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
use clippy_utils::ty::{is_type_diagnostic_item, peel_mid_ty_refs_is_mutable};
use clippy_utils::{
- can_move_expr_to_closure, in_constant, is_allowed, is_else_clause, is_lang_ctor, path_to_local_id,
+ can_move_expr_to_closure, in_constant, is_else_clause, is_lang_ctor, is_lint_allowed, path_to_local_id,
peel_hir_expr_refs,
};
use rustc_ast::util::parser::PREC_POSTFIX;
use rustc_span::{sym, SyntaxContext};
declare_clippy_lint! {
- /// **What it does:** Checks for usages of `match` which could be implemented using `map`
+ /// ### What it does
+ /// Checks for usages of `match` which could be implemented using `map`
///
- /// **Why is this bad?** Using the `map` method is clearer and more concise.
- ///
- /// **Known problems:** None.
- ///
- /// **Example:**
+ /// ### Why is this bad?
+ /// Using the `map` method is clearer and more concise.
///
+ /// ### Example
/// ```rust
/// match Some(0) {
/// Some(x) => Some(x + 1),
// These two lints will go back and forth with each other.
if cx.typeck_results().expr_ty(some_expr) == cx.tcx.types.unit
- && !is_allowed(cx, OPTION_MAP_UNIT_FN, expr.hir_id)
+ && !is_lint_allowed(cx, OPTION_MAP_UNIT_FN, expr.hir_id)
{
return;
}
},
_ => {
if path_to_local_id(some_expr, id)
- && !is_allowed(cx, MATCH_AS_REF, expr.hir_id)
+ && !is_lint_allowed(cx, MATCH_AS_REF, expr.hir_id)
&& binding_ref.is_some()
{
return;