Encode CommandLine in the index only.
This commit is contained in:
parent
66fee063b6
commit
5a731ffdae
2 changed files with 14 additions and 25 deletions
|
@ -121,7 +121,7 @@ impl<'s> LintLevelsBuilder<'s> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.cur = self.sets.list.push(LintSet::CommandLine { specs });
|
self.cur = self.sets.list.push(LintSet { specs, parent: COMMAND_LINE });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to insert the `id` to `level_src` map entry. If unsuccessful
|
/// Attempts to insert the `id` to `level_src` map entry. If unsuccessful
|
||||||
|
@ -524,7 +524,7 @@ impl<'s> LintLevelsBuilder<'s> {
|
||||||
|
|
||||||
let prev = self.cur;
|
let prev = self.cur;
|
||||||
if !specs.is_empty() {
|
if !specs.is_empty() {
|
||||||
self.cur = self.sets.list.push(LintSet::Node { specs, parent: prev });
|
self.cur = self.sets.list.push(LintSet { specs, parent: prev });
|
||||||
}
|
}
|
||||||
|
|
||||||
BuilderPush { prev, changed: prev != self.cur }
|
BuilderPush { prev, changed: prev != self.cur }
|
||||||
|
|
|
@ -66,17 +66,12 @@ rustc_index::newtype_index! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable)]
|
#[derive(Debug, HashStable)]
|
||||||
pub enum LintSet {
|
pub struct LintSet {
|
||||||
CommandLine {
|
|
||||||
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
|
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
|
||||||
// flag.
|
// flag.
|
||||||
specs: FxHashMap<LintId, LevelAndSource>,
|
pub specs: FxHashMap<LintId, LevelAndSource>,
|
||||||
},
|
|
||||||
|
|
||||||
Node {
|
pub parent: LintStackIndex,
|
||||||
specs: FxHashMap<LintId, LevelAndSource>,
|
|
||||||
parent: LintStackIndex,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LintLevelSets {
|
impl LintLevelSets {
|
||||||
|
@ -139,23 +134,17 @@ impl LintLevelSets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
match self.list[idx] {
|
let LintSet { ref specs, parent } = self.list[idx];
|
||||||
LintSet::CommandLine { ref specs } => {
|
|
||||||
if let Some(&(level, src)) = specs.get(&id) {
|
if let Some(&(level, src)) = specs.get(&id) {
|
||||||
return (Some(level), src);
|
return (Some(level), src);
|
||||||
}
|
}
|
||||||
|
if idx == COMMAND_LINE {
|
||||||
return (None, LintLevelSource::Default);
|
return (None, LintLevelSource::Default);
|
||||||
}
|
}
|
||||||
LintSet::Node { ref specs, parent } => {
|
|
||||||
if let Some(&(level, src)) = specs.get(&id) {
|
|
||||||
return (Some(level), src);
|
|
||||||
}
|
|
||||||
idx = parent;
|
idx = parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct LintLevelMap {
|
pub struct LintLevelMap {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue