use rustc_ast as ast;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::{
- self as hir, def::DefKind, intravisit, intravisit::Visitor, ExprKind, Item, ItemKind, Mutability, QPath,
+ self as hir, def::DefKind, intravisit, intravisit::Visitor, Closure, ExprKind, Item, ItemKind, Mutability, QPath,
};
use rustc_lint::{CheckLintNameResult, LateContext, LateLintPass, LintContext, LintId};
use rustc_middle::hir::nested_filter;
fn get_lint_level_from_group(lint_group: &str) -> Option<&'static str> {
DEFAULT_LINT_LEVELS
.iter()
- .find_map(|(group_name, group_level)| (*group_name == lint_group).then(|| *group_level))
+ .find_map(|(group_name, group_level)| (*group_name == lint_group).then_some(*group_level))
}
pub(super) fn is_deprecated_lint(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
}
fn check_is_multi_part<'hir>(cx: &LateContext<'hir>, closure_expr: &'hir hir::Expr<'hir>) -> bool {
- if let ExprKind::Closure { body, .. } = closure_expr.kind {
+ if let ExprKind::Closure(&Closure { body, .. }) = closure_expr.kind {
let mut scanner = IsMultiSpanScanner::new(cx);
intravisit::walk_body(&mut scanner, cx.tcx.hir().body(body));
return scanner.is_multi_part();
/// This visitor finds the highest applicability value in the visited expressions
struct ApplicabilityResolver<'a, 'hir> {
cx: &'a LateContext<'hir>,
- /// This is the index of hightest `Applicability` for `paths::APPLICABILITY_VALUES`
+ /// This is the index of highest `Applicability` for `paths::APPLICABILITY_VALUES`
applicability_index: Option<usize>,
}