Skip to content

Commit cb16543

Browse files
committed
Auto merge of #7449 - flip1995:remove-lints_enabled, r=camsteffen
Remove lints_enabled r? `@camsteffen` cc rust-lang/rust-clippy#7448 (comment) I haven't added a variant with `last_node_with_lint_attrs` yet, since I didn't see a usecase for this. Also this field is not documented, so I'm wondering how it behaves with command line lints and so on. changelog: none
2 parents 8da39e6 + d2c8f50 commit cb16543

15 files changed

+39
-60
lines changed

clippy_lints/src/cargo_common_metadata.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
33
use std::path::PathBuf;
44

5-
use clippy_utils::diagnostics::span_lint;
6-
use clippy_utils::lints_enabled;
5+
use clippy_utils::{diagnostics::span_lint, is_lint_allowed};
76
use rustc_hir::{hir_id::CRATE_HIR_ID, Crate};
87
use rustc_lint::{LateContext, LateLintPass};
98
use rustc_session::{declare_tool_lint, impl_lint_pass};
@@ -85,7 +84,7 @@ fn is_empty_vec(value: &[String]) -> bool {
8584

8685
impl LateLintPass<'_> for CargoCommonMetadata {
8786
fn check_crate(&mut self, cx: &LateContext<'_>, _: &Crate<'_>) {
88-
if !lints_enabled(cx, &[CARGO_COMMON_METADATA], CRATE_HIR_ID) {
87+
if is_lint_allowed(cx, CARGO_COMMON_METADATA, CRATE_HIR_ID) {
8988
return;
9089
}
9190

clippy_lints/src/copies.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_then};
22
use clippy_utils::source::{first_line_of_span, indent_of, reindent_multiline, snippet, snippet_opt};
33
use clippy_utils::{
44
both, count_eq, eq_expr_value, get_enclosing_block, get_parent_expr, if_sequence, in_macro, is_else_clause,
5-
lints_enabled, search_same, ContainsName, SpanlessEq, SpanlessHash,
5+
is_lint_allowed, search_same, ContainsName, SpanlessEq, SpanlessHash,
66
};
77
use if_chain::if_chain;
88
use rustc_data_structures::fx::FxHashSet;
@@ -337,8 +337,8 @@ fn scan_block_for_eq(cx: &LateContext<'tcx>, blocks: &[&Block<'tcx>]) -> Option<
337337
if block_expr_eq;
338338
if l_stmts.len() == r_stmts.len();
339339
if l_stmts.len() == current_start_eq;
340-
if lints_enabled(cx, &[IF_SAME_THEN_ELSE], win[0].hir_id);
341-
if lints_enabled(cx, &[IF_SAME_THEN_ELSE], win[1].hir_id);
340+
if !is_lint_allowed(cx, IF_SAME_THEN_ELSE, win[0].hir_id);
341+
if !is_lint_allowed(cx, IF_SAME_THEN_ELSE, win[1].hir_id);
342342
then {
343343
span_lint_and_note(
344344
cx,

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::source::snippet_with_context;
33
use clippy_utils::ty::peel_mid_ty_refs;
4-
use clippy_utils::{get_parent_node, in_macro, is_allowed};
4+
use clippy_utils::{get_parent_node, in_macro, is_lint_allowed};
55
use rustc_ast::util::parser::PREC_PREFIX;
66
use rustc_errors::Applicability;
77
use rustc_hir::{BorrowKind, Expr, ExprKind, HirId, MatchSource, Mutability, Node, UnOp};
@@ -107,7 +107,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing {
107107

108108
match kind {
109109
RefOp::Method(target_mut)
110-
if !is_allowed(cx, EXPLICIT_DEREF_METHODS, expr.hir_id)
110+
if !is_lint_allowed(cx, EXPLICIT_DEREF_METHODS, expr.hir_id)
111111
&& is_linted_explicit_deref_position(parent, expr.hir_id, expr.span) =>
112112
{
113113
self.state = Some((

clippy_lints/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note, span_lint_and_then};
22
use clippy_utils::paths;
33
use clippy_utils::ty::{implements_trait, is_copy};
4-
use clippy_utils::{get_trait_def_id, is_allowed, is_automatically_derived, match_def_path};
4+
use clippy_utils::{get_trait_def_id, is_automatically_derived, is_lint_allowed, match_def_path};
55
use if_chain::if_chain;
66
use rustc_hir::def_id::DefId;
77
use rustc_hir::intravisit::{walk_expr, walk_fn, walk_item, FnKind, NestedVisitorMap, Visitor};
@@ -362,7 +362,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
362362
if let ty::Adt(def, _) = ty.kind();
363363
if let Some(local_def_id) = def.did.as_local();
364364
let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
365-
if !is_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
365+
if !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
366366
if cx.tcx.inherent_impls(def.did)
367367
.iter()
368368
.map(|imp_did| item_from_def_id(cx, *imp_did))

clippy_lints/src/inherent_impl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! lint on inherent implementations
22
33
use clippy_utils::diagnostics::span_lint_and_note;
4-
use clippy_utils::{in_macro, is_allowed};
4+
use clippy_utils::{in_macro, is_lint_allowed};
55
use rustc_data_structures::fx::FxHashMap;
66
use rustc_hir::{def_id::LocalDefId, Crate, Item, ItemKind, Node};
77
use rustc_lint::{LateContext, LateLintPass};
@@ -59,7 +59,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
5959
.filter(|(&id, impls)| {
6060
impls.len() > 1
6161
// Check for `#[allow]` on the type definition
62-
&& !is_allowed(
62+
&& !is_lint_allowed(
6363
cx,
6464
MULTIPLE_INHERENT_IMPL,
6565
cx.tcx.hir().local_def_id_to_hir_id(id),
@@ -123,7 +123,7 @@ fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
123123
..
124124
}) = cx.tcx.hir().get(id)
125125
{
126-
(!in_macro(span) && impl_item.generics.params.is_empty() && !is_allowed(cx, MULTIPLE_INHERENT_IMPL, id))
126+
(!in_macro(span) && impl_item.generics.params.is_empty() && !is_lint_allowed(cx, MULTIPLE_INHERENT_IMPL, id))
127127
.then(|| span)
128128
} else {
129129
None

clippy_lints/src/len_zero.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_then};
22
use clippy_utils::source::snippet_with_applicability;
3-
use clippy_utils::{get_item_name, get_parent_as_impl, is_allowed};
3+
use clippy_utils::{get_item_name, get_parent_as_impl, is_lint_allowed};
44
use if_chain::if_chain;
55
use rustc_ast::ast::LitKind;
66
use rustc_errors::Applicability;
@@ -139,7 +139,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
139139
if let Some(ty_id) = cx.qpath_res(ty_path, imp.self_ty.hir_id).opt_def_id();
140140
if let Some(local_id) = ty_id.as_local();
141141
let ty_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_id);
142-
if !is_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id);
142+
if !is_lint_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id);
143143
if let Some(output) = parse_len_output(cx, cx.tcx.fn_sig(item.def_id).skip_binder());
144144
then {
145145
let (name, kind) = match cx.tcx.hir().find(ty_hir_id) {

clippy_lints/src/manual_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
33
use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
44
use clippy_utils::ty::{is_type_diagnostic_item, peel_mid_ty_refs_is_mutable};
55
use clippy_utils::{
6-
can_move_expr_to_closure, in_constant, is_allowed, is_else_clause, is_lang_ctor, path_to_local_id,
6+
can_move_expr_to_closure, in_constant, is_else_clause, is_lang_ctor, is_lint_allowed, path_to_local_id,
77
peel_hir_expr_refs,
88
};
99
use rustc_ast::util::parser::PREC_POSTFIX;
@@ -102,7 +102,7 @@ impl LateLintPass<'_> for ManualMap {
102102

103103
// These two lints will go back and forth with each other.
104104
if cx.typeck_results().expr_ty(some_expr) == cx.tcx.types.unit
105-
&& !is_allowed(cx, OPTION_MAP_UNIT_FN, expr.hir_id)
105+
&& !is_lint_allowed(cx, OPTION_MAP_UNIT_FN, expr.hir_id)
106106
{
107107
return;
108108
}
@@ -146,7 +146,7 @@ impl LateLintPass<'_> for ManualMap {
146146
},
147147
_ => {
148148
if path_to_local_id(some_expr, id)
149-
&& !is_allowed(cx, MATCH_AS_REF, expr.hir_id)
149+
&& !is_lint_allowed(cx, MATCH_AS_REF, expr.hir_id)
150150
&& binding_ref.is_some()
151151
{
152152
return;

clippy_lints/src/matches.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clippy_utils::sugg::Sugg;
77
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item, match_type, peel_mid_ty_refs};
88
use clippy_utils::visitors::LocalUsedVisitor;
99
use clippy_utils::{
10-
get_parent_expr, in_macro, is_allowed, is_expn_of, is_lang_ctor, is_refutable, is_wild, meets_msrv, msrvs,
10+
get_parent_expr, in_macro, is_expn_of, is_lang_ctor, is_lint_allowed, is_refutable, is_wild, meets_msrv, msrvs,
1111
path_to_local, path_to_local_id, peel_hir_pat_refs, peel_n_hir_expr_refs, recurse_or_patterns, remove_blocks,
1212
strip_pat_refs,
1313
};
@@ -707,7 +707,7 @@ fn check_single_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>], exp
707707
};
708708

709709
let ty = cx.typeck_results().expr_ty(ex);
710-
if *ty.kind() != ty::Bool || is_allowed(cx, MATCH_BOOL, ex.hir_id) {
710+
if *ty.kind() != ty::Bool || is_lint_allowed(cx, MATCH_BOOL, ex.hir_id) {
711711
check_single_match_single_pattern(cx, ex, arms, expr, els);
712712
check_single_match_opt_like(cx, ex, arms, expr, ty, els);
713713
}

clippy_lints/src/multiple_crate_versions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! lint on multiple versions of a crate being used
22
33
use clippy_utils::diagnostics::span_lint;
4-
use clippy_utils::lints_enabled;
4+
use clippy_utils::is_lint_allowed;
55
use rustc_hir::def_id::LOCAL_CRATE;
66
use rustc_hir::{Crate, CRATE_HIR_ID};
77
use rustc_lint::{LateContext, LateLintPass};
@@ -39,7 +39,7 @@ declare_lint_pass!(MultipleCrateVersions => [MULTIPLE_CRATE_VERSIONS]);
3939

4040
impl LateLintPass<'_> for MultipleCrateVersions {
4141
fn check_crate(&mut self, cx: &LateContext<'_>, _: &Crate<'_>) {
42-
if !lints_enabled(cx, &[MULTIPLE_CRATE_VERSIONS], CRATE_HIR_ID) {
42+
if is_lint_allowed(cx, MULTIPLE_CRATE_VERSIONS, CRATE_HIR_ID) {
4343
return;
4444
}
4545

clippy_lints/src/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_the
44
use clippy_utils::ptr::get_spans;
55
use clippy_utils::source::snippet_opt;
66
use clippy_utils::ty::{is_type_diagnostic_item, match_type, walk_ptrs_hir_ty};
7-
use clippy_utils::{expr_path_res, is_allowed, match_any_def_paths, paths};
7+
use clippy_utils::{expr_path_res, is_lint_allowed, match_any_def_paths, paths};
88
use if_chain::if_chain;
99
use rustc_errors::Applicability;
1010
use rustc_hir::{
@@ -246,7 +246,7 @@ fn check_fn(cx: &LateContext<'_>, decl: &FnDecl<'_>, fn_id: HirId, opt_body_id:
246246
for (idx, (arg, ty)) in decl.inputs.iter().zip(fn_ty.inputs()).enumerate() {
247247
// Honor the allow attribute on parameters. See issue 5644.
248248
if let Some(body) = &body {
249-
if is_allowed(cx, PTR_ARG, body.params[idx].hir_id) {
249+
if is_lint_allowed(cx, PTR_ARG, body.params[idx].hir_id) {
250250
continue;
251251
}
252252
}

clippy_lints/src/strings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_sug
22
use clippy_utils::source::{snippet, snippet_with_applicability};
33
use clippy_utils::ty::is_type_diagnostic_item;
44
use clippy_utils::SpanlessEq;
5-
use clippy_utils::{get_parent_expr, is_allowed, match_function_call, method_calls, paths};
5+
use clippy_utils::{get_parent_expr, is_lint_allowed, match_function_call, method_calls, paths};
66
use if_chain::if_chain;
77
use rustc_errors::Applicability;
88
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, LangItem, QPath};
@@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for StringAdd {
124124
) = e.kind
125125
{
126126
if is_string(cx, left) {
127-
if !is_allowed(cx, STRING_ADD_ASSIGN, e.hir_id) {
127+
if !is_lint_allowed(cx, STRING_ADD_ASSIGN, e.hir_id) {
128128
let parent = get_parent_expr(cx, e);
129129
if let Some(p) = parent {
130130
if let ExprKind::Assign(target, _, _) = p.kind {

clippy_lints/src/unicode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
2-
use clippy_utils::is_allowed;
2+
use clippy_utils::is_lint_allowed;
33
use clippy_utils::source::snippet;
44
use rustc_ast::ast::LitKind;
55
use rustc_errors::Applicability;
@@ -114,15 +114,15 @@ fn check_str(cx: &LateContext<'_>, span: Span, id: HirId) {
114114
span,
115115
"literal non-ASCII character detected",
116116
"consider replacing the string with",
117-
if is_allowed(cx, UNICODE_NOT_NFC, id) {
117+
if is_lint_allowed(cx, UNICODE_NOT_NFC, id) {
118118
escape(string.chars())
119119
} else {
120120
escape(string.nfc())
121121
},
122122
Applicability::MachineApplicable,
123123
);
124124
}
125-
if is_allowed(cx, NON_ASCII_LITERAL, id) && string.chars().zip(string.nfc()).any(|(a, b)| a != b) {
125+
if is_lint_allowed(cx, NON_ASCII_LITERAL, id) && string.chars().zip(string.nfc()).any(|(a, b)| a != b) {
126126
span_lint_and_sugg(
127127
cx,
128128
UNICODE_NOT_NFC,

clippy_lints/src/utils/internal_lints.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_sug
33
use clippy_utils::source::snippet;
44
use clippy_utils::ty::match_type;
55
use clippy_utils::{
6-
is_else_clause, is_expn_of, is_expr_path_def_path, lints_enabled, match_def_path, method_calls, path_to_res, paths,
7-
SpanlessEq,
6+
is_else_clause, is_expn_of, is_expr_path_def_path, is_lint_allowed, match_def_path, method_calls, path_to_res,
7+
paths, SpanlessEq,
88
};
99
use if_chain::if_chain;
1010
use rustc_ast::ast::{Crate as AstCrate, ItemKind, LitKind, ModKind, NodeId};
@@ -353,7 +353,7 @@ impl_lint_pass!(LintWithoutLintPass => [DEFAULT_LINT, LINT_WITHOUT_LINT_PASS]);
353353

354354
impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
355355
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
356-
if !lints_enabled(cx, &[DEFAULT_LINT], item.hir_id()) {
356+
if is_lint_allowed(cx, DEFAULT_LINT, item.hir_id()) {
357357
return;
358358
}
359359

@@ -411,7 +411,7 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
411411
}
412412

413413
fn check_crate_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx Crate<'_>) {
414-
if !lints_enabled(cx, &[LINT_WITHOUT_LINT_PASS], CRATE_HIR_ID) {
414+
if is_lint_allowed(cx, LINT_WITHOUT_LINT_PASS, CRATE_HIR_ID) {
415415
return;
416416
}
417417

@@ -497,7 +497,7 @@ impl_lint_pass!(CompilerLintFunctions => [COMPILER_LINT_FUNCTIONS]);
497497

498498
impl<'tcx> LateLintPass<'tcx> for CompilerLintFunctions {
499499
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
500-
if !lints_enabled(cx, &[COMPILER_LINT_FUNCTIONS], expr.hir_id) {
500+
if is_lint_allowed(cx, COMPILER_LINT_FUNCTIONS, expr.hir_id) {
501501
return;
502502
}
503503

@@ -526,7 +526,7 @@ declare_lint_pass!(OuterExpnDataPass => [OUTER_EXPN_EXPN_DATA]);
526526

527527
impl<'tcx> LateLintPass<'tcx> for OuterExpnDataPass {
528528
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
529-
if !lints_enabled(cx, &[OUTER_EXPN_EXPN_DATA], expr.hir_id) {
529+
if is_lint_allowed(cx, OUTER_EXPN_EXPN_DATA, expr.hir_id) {
530530
return;
531531
}
532532

@@ -576,7 +576,7 @@ declare_lint_pass!(CollapsibleCalls => [COLLAPSIBLE_SPAN_LINT_CALLS]);
576576

577577
impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
578578
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
579-
if !lints_enabled(cx, &[COLLAPSIBLE_SPAN_LINT_CALLS], expr.hir_id) {
579+
if is_lint_allowed(cx, COLLAPSIBLE_SPAN_LINT_CALLS, expr.hir_id) {
580580
return;
581581
}
582582

@@ -757,7 +757,7 @@ declare_lint_pass!(MatchTypeOnDiagItem => [MATCH_TYPE_ON_DIAGNOSTIC_ITEM]);
757757

758758
impl<'tcx> LateLintPass<'tcx> for MatchTypeOnDiagItem {
759759
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
760-
if !lints_enabled(cx, &[MATCH_TYPE_ON_DIAGNOSTIC_ITEM], expr.hir_id) {
760+
if is_lint_allowed(cx, MATCH_TYPE_ON_DIAGNOSTIC_ITEM, expr.hir_id) {
761761
return;
762762
}
763763

clippy_lints/src/wildcard_dependencies.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use clippy_utils::diagnostics::span_lint;
2-
use clippy_utils::lints_enabled;
1+
use clippy_utils::{diagnostics::span_lint, is_lint_allowed};
32
use rustc_hir::{hir_id::CRATE_HIR_ID, Crate};
43
use rustc_lint::{LateContext, LateLintPass};
54
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -31,7 +30,7 @@ declare_lint_pass!(WildcardDependencies => [WILDCARD_DEPENDENCIES]);
3130

3231
impl LateLintPass<'_> for WildcardDependencies {
3332
fn check_crate(&mut self, cx: &LateContext<'_>, _: &Crate<'_>) {
34-
if !lints_enabled(cx, &[WILDCARD_DEPENDENCIES], CRATE_HIR_ID) {
33+
if is_lint_allowed(cx, WILDCARD_DEPENDENCIES, CRATE_HIR_ID) {
3534
return;
3635
}
3736

clippy_utils/src/lib.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ pub fn is_try<'tcx>(cx: &LateContext<'_>, expr: &'tcx Expr<'tcx>) -> Option<&'tc
11731173
/// Returns `true` if the lint is allowed in the current context
11741174
///
11751175
/// Useful for skipping long running code when it's unnecessary
1176-
pub fn is_allowed(cx: &LateContext<'_>, lint: &'static Lint, id: HirId) -> bool {
1176+
pub fn is_lint_allowed(cx: &LateContext<'_>, lint: &'static Lint, id: HirId) -> bool {
11771177
cx.tcx.lint_level_at_node(lint, id).0 == Level::Allow
11781178
}
11791179

@@ -1541,25 +1541,6 @@ pub fn fn_def_id(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<DefId> {
15411541
}
15421542
}
15431543

1544-
/// This function checks if any of the lints in the slice is enabled for the provided `HirId`.
1545-
/// A lint counts as enabled with any of the levels: `Level::Forbid` | `Level::Deny` | `Level::Warn`
1546-
///
1547-
/// ```ignore
1548-
/// #[deny(clippy::YOUR_AWESOME_LINT)]
1549-
/// println!("Hello, World!"); // <- Clippy code: lints_enabled(cx, &[YOUR_AWESOME_LINT], id) == true
1550-
///
1551-
/// #[allow(clippy::YOUR_AWESOME_LINT)]
1552-
/// println!("See you soon!"); // <- Clippy code: lints_enabled(cx, &[YOUR_AWESOME_LINT], id) == false
1553-
/// ```
1554-
pub fn lints_enabled(cx: &LateContext<'_>, lints: &[&'static Lint], id: HirId) -> bool {
1555-
lints.iter().any(|lint| {
1556-
matches!(
1557-
cx.tcx.lint_level_at_node(lint, id),
1558-
(Level::Forbid | Level::Deny | Level::Warn, _)
1559-
)
1560-
})
1561-
}
1562-
15631544
/// Returns Option<String> where String is a textual representation of the type encapsulated in the
15641545
/// slice iff the given expression is a slice of primitives (as defined in the
15651546
/// `is_recursively_primitive_type` function) and None otherwise.

0 commit comments

Comments
 (0)