-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathlint_groups.rs
42 lines (38 loc) · 1.28 KB
/
lint_groups.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use serde::{Deserialize, Serialize};
use crate::{LintKind, LintLevel};
/// End-user configuration for a lint group.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct GroupConfig {
#[serde(rename = "group")]
/// The lint group.
pub lint_group: LintGroup,
/// The group level.
pub level: LintLevel,
}
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum LintGroup {
Pedantic,
}
impl LintGroup {
pub fn unfold(self) -> Vec<LintKind> {
use crate::AstLint::*;
use crate::HirLint::*;
match self {
LintGroup::Pedantic => {
vec![
LintKind::Ast(DivisionByZero),
LintKind::Ast(NeedlessParens),
LintKind::Ast(RedundantSemicolons),
LintKind::Ast(DeprecatedNewtype),
LintKind::Ast(DeprecatedSet),
LintKind::Ast(DiscourageChainAssignment),
LintKind::Hir(NeedlessOperation),
LintKind::Hir(DeprecatedFunctionConstructor),
LintKind::Hir(DeprecatedWithOperator),
LintKind::Hir(DeprecatedDoubleColonOperator),
]
}
}
}
}