@@ -14,8 +14,8 @@ use toml_edit::ImDocument;
14
14
15
15
const LINT_GROUPS : & [ LintGroup ] = & [ TEST_DUMMY_UNSTABLE ] ;
16
16
pub const LINTS : & [ Lint ] = & [
17
- IM_A_TEAPOT ,
18
17
IMPLICIT_FEATURES ,
18
+ IM_A_TEAPOT ,
19
19
UNKNOWN_LINTS ,
20
20
UNUSED_OPTIONAL_DEPENDENCY ,
21
21
] ;
@@ -875,3 +875,42 @@ pub fn unused_dependencies(
875
875
}
876
876
Ok ( ( ) )
877
877
}
878
+
879
+ #[ cfg( test) ]
880
+ mod tests {
881
+ use snapbox:: ToDebug ;
882
+
883
+ #[ test]
884
+ fn ensure_sorted_lints ( ) {
885
+ // This will be printed out if the fields are not sorted.
886
+ let location = std:: panic:: Location :: caller ( ) ;
887
+ println ! ( "\n To fix this test, sort `LINTS` in {}\n " , location. file( ) , ) ;
888
+
889
+ let actual = super :: LINTS
890
+ . iter ( )
891
+ . map ( |l| l. name . to_uppercase ( ) )
892
+ . collect :: < Vec < _ > > ( ) ;
893
+
894
+ let mut expected = actual. clone ( ) ;
895
+ expected. sort ( ) ;
896
+ snapbox:: assert_data_eq!( actual. to_debug( ) , expected. to_debug( ) ) ;
897
+ }
898
+
899
+ #[ test]
900
+ fn ensure_sorted_lint_groups ( ) {
901
+ // This will be printed out if the fields are not sorted.
902
+ let location = std:: panic:: Location :: caller ( ) ;
903
+ println ! (
904
+ "\n To fix this test, sort `LINT_GROUPS` in {}\n " ,
905
+ location. file( ) ,
906
+ ) ;
907
+ let actual = super :: LINT_GROUPS
908
+ . iter ( )
909
+ . map ( |l| l. name . to_uppercase ( ) )
910
+ . collect :: < Vec < _ > > ( ) ;
911
+
912
+ let mut expected = actual. clone ( ) ;
913
+ expected. sort ( ) ;
914
+ snapbox:: assert_data_eq!( actual. to_debug( ) , expected. to_debug( ) ) ;
915
+ }
916
+ }
0 commit comments