Skip to content

Commit 5b90fe1

Browse files
authored
Rollup merge of rust-lang#80935 - pierwill:rustc_middle-levelandsource, r=petrochenkov
Rename `rustc_middle::lint::LevelSource` to `LevelAndSource` This continues work in rust-lang#80274 to improve code readability. This naming follows a pattern seen elsewhere in the compiler (e.g. [`rustc_middle::ty::TypeAndMut`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeAndMut.html)).
2 parents c64d3f0 + 2e3ab43 commit 5b90fe1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

compiler/rustc_lint/src/levels.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir as hir;
1010
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
1111
use rustc_hir::{intravisit, HirId};
1212
use rustc_middle::hir::map::Map;
13-
use rustc_middle::lint::LevelSource;
13+
use rustc_middle::lint::LevelAndSource;
1414
use rustc_middle::lint::LintDiagnosticBuilder;
1515
use rustc_middle::lint::{
1616
struct_lint_level, LintLevelMap, LintLevelSets, LintLevelSource, LintSet,
@@ -106,9 +106,9 @@ impl<'s> LintLevelsBuilder<'s> {
106106
/// diagnostic with no change to `specs`.
107107
fn insert_spec(
108108
&mut self,
109-
specs: &mut FxHashMap<LintId, LevelSource>,
109+
specs: &mut FxHashMap<LintId, LevelAndSource>,
110110
id: LintId,
111-
(level, src): LevelSource,
111+
(level, src): LevelAndSource,
112112
) {
113113
// Setting to a non-forbid level is an error if the lint previously had
114114
// a forbid level. Note that this is not necessarily true even with a

compiler/rustc_middle/src/lint.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl LintLevelSource {
4646
}
4747

4848
/// A tuple of a lint level and its source.
49-
pub type LevelSource = (Level, LintLevelSource);
49+
pub type LevelAndSource = (Level, LintLevelSource);
5050

5151
pub struct LintLevelSets {
5252
pub list: Vec<LintSet>,
@@ -57,11 +57,11 @@ pub enum LintSet {
5757
CommandLine {
5858
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
5959
// flag.
60-
specs: FxHashMap<LintId, LevelSource>,
60+
specs: FxHashMap<LintId, LevelAndSource>,
6161
},
6262

6363
Node {
64-
specs: FxHashMap<LintId, LevelSource>,
64+
specs: FxHashMap<LintId, LevelAndSource>,
6565
parent: u32,
6666
},
6767
}
@@ -75,9 +75,9 @@ impl LintLevelSets {
7575
&self,
7676
lint: &'static Lint,
7777
idx: u32,
78-
aux: Option<&FxHashMap<LintId, LevelSource>>,
78+
aux: Option<&FxHashMap<LintId, LevelAndSource>>,
7979
sess: &Session,
80-
) -> LevelSource {
80+
) -> LevelAndSource {
8181
let (level, mut src) = self.get_lint_id_level(LintId::of(lint), idx, aux);
8282

8383
// If `level` is none then we actually assume the default level for this
@@ -113,7 +113,7 @@ impl LintLevelSets {
113113
&self,
114114
id: LintId,
115115
mut idx: u32,
116-
aux: Option<&FxHashMap<LintId, LevelSource>>,
116+
aux: Option<&FxHashMap<LintId, LevelAndSource>>,
117117
) -> (Option<Level>, LintLevelSource) {
118118
if let Some(specs) = aux {
119119
if let Some(&(level, src)) = specs.get(&id) {
@@ -157,7 +157,7 @@ impl LintLevelMap {
157157
lint: &'static Lint,
158158
id: HirId,
159159
session: &Session,
160-
) -> Option<LevelSource> {
160+
) -> Option<LevelAndSource> {
161161
self.id_to_set.get(&id).map(|idx| self.sets.get_lint_level(lint, *idx, None, session))
162162
}
163163
}

0 commit comments

Comments
 (0)