Skip to content

Commit 52c0f13

Browse files
committed
Support deprecated lints in find_lints
1 parent 5384f0f commit 52c0f13

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/librustc/lint/context.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl LintStore {
297297
self.by_name.insert(name.into(), Removed(reason.into()));
298298
}
299299

300-
pub fn find_lints(&self, lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
300+
pub fn find_lints(&self, mut lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
301301
match self.by_name.get(lint_name) {
302302
Some(&Id(lint_id)) => Ok(vec![lint_id]),
303303
Some(&Renamed(_, lint_id)) => {
@@ -307,9 +307,17 @@ impl LintStore {
307307
Err(FindLintError::Removed)
308308
},
309309
None => {
310-
match self.lint_groups.get(lint_name) {
311-
Some(v) => Ok(v.0.clone()),
312-
None => Err(FindLintError::Removed)
310+
loop {
311+
return match self.lint_groups.get(lint_name) {
312+
Some((ids, _, depr)) => {
313+
if let Some((name, _)) = depr {
314+
lint_name = name;
315+
continue;
316+
}
317+
Ok(ids.clone())
318+
}
319+
None => Err(FindLintError::Removed)
320+
};
313321
}
314322
}
315323
}

0 commit comments

Comments
 (0)