-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlint.rs
47 lines (43 loc) · 1.38 KB
/
lint.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
43
44
45
46
47
use rustc_lint::{Level, Lint};
/// A Bevy lint definition and its associated group.
///
/// The level of the lint must be the same as the level of the group.
pub struct BevyLint {
pub lint: &'static Lint,
pub group: &'static LintGroup,
}
/// Represents a lint group.
pub struct LintGroup {
/// The name of the lint group.
///
/// This will be used when trying to enable / disable the group, such as through
/// `#![allow(group)]`. By convention, this should start with `bevy::`.
pub name: &'static str,
// The default level all lints within this group should be.
pub level: Level,
}
#[macro_export]
macro_rules! declare_bevy_lint {
{
$(#[$attr:meta])*
$vis:vis $name:ident,
$group:ident,
$desc:expr$(,)?
} => {
$(#[$attr])*
$vis static $name: &$crate::lint::BevyLint = &$crate::lint::BevyLint {
lint: &::rustc_lint::Lint {
name: concat!("bevy::", stringify!($name)),
default_level: $crate::groups::$group.level,
desc: $desc,
edition_lint_opts: None,
report_in_external_macro: false,
future_incompatible: None,
is_externally_loaded: true,
feature_gate: None,
crate_level_only: false,
},
group: &$crate::groups::$group,
};
};
}