diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2021-05-05 10:33:14 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2021-05-05 13:11:52 -0500 |
| commit | 25c66a13a9b9a646e247f8ed15828d621cdf30fa (patch) | |
| tree | bca33a78e69af4ad94d414c669afba6fe98857aa /compiler/rustc_lint/src | |
| parent | 24acc388da2cdbe1ec79b6933402941b6fffb26b (diff) | |
Suggest lint groups
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/context.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index c1d6a4f1de1..cd6a6138c85 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -468,17 +468,17 @@ impl LintStore { fn no_lint_suggestion(&self, lint_name: &str) -> CheckLintNameResult<'_> { let name_lower = lint_name.to_lowercase(); - let symbols = - self.get_lints().iter().map(|l| Symbol::intern(&l.name_lower())).collect::<Vec<_>>(); if lint_name.chars().any(char::is_uppercase) && self.find_lints(&name_lower).is_ok() { // First check if the lint name is (partly) in upper case instead of lower case... - CheckLintNameResult::NoLint(Some(Symbol::intern(&name_lower))) - } else { - // ...if not, search for lints with a similar name - let suggestion = find_best_match_for_name(&symbols, Symbol::intern(&name_lower), None); - CheckLintNameResult::NoLint(suggestion) + return CheckLintNameResult::NoLint(Some(Symbol::intern(&name_lower))); } + // ...if not, search for lints with a similar name + let groups = self.lint_groups.keys().copied().map(Symbol::intern); + let lints = self.lints.iter().map(|l| Symbol::intern(&l.name_lower())); + let names: Vec<Symbol> = groups.chain(lints).collect(); + let suggestion = find_best_match_for_name(&names, Symbol::intern(&name_lower), None); + CheckLintNameResult::NoLint(suggestion) } fn check_tool_name_for_backwards_compat( |
