Skip to content

Commit 9451626

Browse files
committed
Remove LintExpectationId from Level variants
1 parent b60a516 commit 9451626

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

clippy_lints/src/duplicate_mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_help;
22
use rustc_ast::ast::{Crate, Inline, Item, ItemKind, ModKind};
33
use rustc_errors::MultiSpan;
44
use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext};
5+
use rustc_middle::lint::LevelAndSource;
56
use rustc_session::impl_lint_pass;
67
use rustc_span::{FileName, Span};
78
use std::collections::BTreeMap;
@@ -45,11 +46,10 @@ declare_clippy_lint! {
4546
"file loaded as module multiple times"
4647
}
4748

48-
#[derive(PartialOrd, Ord, PartialEq, Eq)]
4949
struct Modules {
5050
local_path: PathBuf,
5151
spans: Vec<Span>,
52-
lint_levels: Vec<Level>,
52+
lint_levels: Vec<LevelAndSource>,
5353
}
5454

5555
#[derive(Default)]
@@ -95,11 +95,11 @@ impl EarlyLintPass for DuplicateMod {
9595
.iter()
9696
.zip(lint_levels)
9797
.filter_map(|(span, lvl)| {
98-
if let Some(id) = lvl.get_expectation_id() {
98+
if let Some(id) = lvl.lint_id {
9999
cx.fulfill_expectation(id);
100100
}
101101

102-
(!matches!(lvl, Level::Allow | Level::Expect(_))).then_some(*span)
102+
(!matches!(lvl.level, Level::Allow | Level::Expect)).then_some(*span)
103103
})
104104
.collect();
105105

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ mod zombie_processes;
408408

409409
use clippy_config::{Conf, get_configuration_metadata, sanitize_explanation};
410410
use clippy_utils::macros::FormatArgsStorage;
411-
use utils::attr_collector::{AttrCollector, AttrStorage};
412411
use rustc_data_structures::fx::FxHashSet;
413412
use rustc_lint::{Lint, LintId};
413+
use utils::attr_collector::{AttrCollector, AttrStorage};
414414

415415
/// Register all pre expansion lints
416416
///

clippy_lints/src/raw_strings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl RawStrings {
138138
);
139139
},
140140
);
141-
if !matches!(cx.get_lint_level(NEEDLESS_RAW_STRINGS), rustc_lint::Allow) {
141+
if !matches!(cx.get_lint_level(NEEDLESS_RAW_STRINGS).level, rustc_lint::Allow) {
142142
return;
143143
}
144144
}

clippy_lints/src/returns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn check_final_expr<'tcx>(
404404
match cx.tcx.hir_attrs(expr.hir_id) {
405405
[] => {},
406406
[attr] => {
407-
if matches!(Level::from_attr(attr), Some(Level::Expect(_)))
407+
if matches!(Level::from_attr(attr), Some((Level::Expect, _)))
408408
&& let metas = attr.meta_item_list()
409409
&& let Some(lst) = metas
410410
&& let [MetaItemInner::MetaItem(meta_item), ..] = lst.as_slice()

clippy_utils/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1977,14 +1977,14 @@ pub fn fulfill_or_allowed(cx: &LateContext<'_>, lint: &'static Lint, ids: impl I
19771977
let mut suppress_lint = false;
19781978

19791979
for id in ids {
1980-
let LevelAndSource { level, .. } = cx.tcx.lint_level_at_node(lint, id);
1981-
if let Some(expectation) = level.get_expectation_id() {
1980+
let LevelAndSource { level, lint_id, .. } = cx.tcx.lint_level_at_node(lint, id);
1981+
if let Some(expectation) = lint_id {
19821982
cx.fulfill_expectation(expectation);
19831983
}
19841984

19851985
match level {
1986-
Level::Allow | Level::Expect(_) => suppress_lint = true,
1987-
Level::Warn | Level::ForceWarn(_) | Level::Deny | Level::Forbid => {},
1986+
Level::Allow | Level::Expect => suppress_lint = true,
1987+
Level::Warn | Level::ForceWarn | Level::Deny | Level::Forbid => {},
19881988
}
19891989
}
19901990

0 commit comments

Comments
 (0)