Skip to content

Commit

Permalink
Support deprecated lints in find_lints
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Sep 15, 2018
1 parent 5384f0f commit 52c0f13
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/librustc/lint/context.rs
Expand Up @@ -297,7 +297,7 @@ impl LintStore {
self.by_name.insert(name.into(), Removed(reason.into()));
}

pub fn find_lints(&self, lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
pub fn find_lints(&self, mut lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
match self.by_name.get(lint_name) {
Some(&Id(lint_id)) => Ok(vec![lint_id]),
Some(&Renamed(_, lint_id)) => {
Expand All @@ -307,9 +307,17 @@ impl LintStore {
Err(FindLintError::Removed)
},
None => {
match self.lint_groups.get(lint_name) {
Some(v) => Ok(v.0.clone()),
None => Err(FindLintError::Removed)
loop {
return match self.lint_groups.get(lint_name) {
Some((ids, _, depr)) => {
if let Some((name, _)) = depr {
lint_name = name;
continue;
}
Ok(ids.clone())
}
None => Err(FindLintError::Removed)
};
}
}
}
Expand Down

0 comments on commit 52c0f13

Please sign in to comment.