mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Make lint groups work correctly with warningsAsInfo
and warningsAsHint
This commit is contained in:
parent
b69eee6487
commit
3dc898389f
4 changed files with 1042 additions and 94 deletions
|
@ -282,3 +282,21 @@ pub fn for_each_break_expr(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if the given lint is equal or is contained by the other lint which may or may not be a group.
|
||||
pub fn lint_eq_or_in_group(lint: &str, lint_is: &str) -> bool {
|
||||
if lint == lint_is {
|
||||
return true;
|
||||
}
|
||||
|
||||
if let Some(group) = generated_lints::DEFAULT_LINT_GROUPS
|
||||
.iter()
|
||||
.chain(generated_lints::CLIPPY_LINT_GROUPS.iter())
|
||||
.chain(generated_lints::RUSTDOC_LINT_GROUPS.iter())
|
||||
.find(|&check| check.lint.label == lint_is)
|
||||
{
|
||||
group.children.contains(&lint)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue