File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( rustc_private) ]
2
+
3
+ // This test checks that all lints defined in `clippy_config::conf` in `#[lints]`
4
+ // attributes exist as Clippy lints.
5
+ //
6
+ // This test is a no-op if run as part of the compiler test suite
7
+ // and will always succeed.
8
+
9
+ use std:: collections:: HashSet ;
10
+
11
+ #[ test]
12
+ fn config_consistency ( ) {
13
+ if option_env ! ( "RUSTC_TEST_SUITE" ) . is_some ( ) {
14
+ return ;
15
+ }
16
+
17
+ let lint_names: HashSet < String > = clippy_lints:: declared_lints:: LINTS
18
+ . iter ( )
19
+ . map ( |lint_info| lint_info. lint . name . strip_prefix ( "clippy::" ) . unwrap ( ) . to_lowercase ( ) )
20
+ . collect ( ) ;
21
+ for conf in clippy_config:: get_configuration_metadata ( ) {
22
+ for lint in conf. lints {
23
+ if !lint_names. contains ( * lint) {
24
+ panic ! (
25
+ "Configuration option {} references lint `{lint}` which does not exist" ,
26
+ conf. name
27
+ ) ;
28
+ }
29
+ }
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments