diff options
| author | varkor <github@varkor.com> | 2018-09-15 17:05:52 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-09-15 17:05:52 +0100 |
| commit | 52c0f13ff164dc2e05b488e3dec939dee25e2745 (patch) | |
| tree | c08e95a0cb14af05ef493eef32e232ddddc2c156 | |
| parent | 5384f0fd3e76013f4a3a72dcb3f017ff943ff325 (diff) | |
| download | rust-52c0f13ff164dc2e05b488e3dec939dee25e2745.tar.gz rust-52c0f13ff164dc2e05b488e3dec939dee25e2745.zip | |
Support deprecated lints in find_lints
| -rw-r--r-- | src/librustc/lint/context.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index f498935a815..c633ae57fa9 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -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)) => { @@ -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) + }; } } } |
