@@ -926,11 +926,6 @@ fn main() {
926
926
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
927
927
}
928
928
929
- trait BAD_TRAIT {
930
- fn BAD_FUNCTION();
931
- fn BadFunction();
932
- }
933
-
934
929
#[allow(non_snake_case, non_camel_case_types)]
935
930
pub struct some_type {
936
931
SOME_FIELD: u8,
@@ -981,22 +976,41 @@ fn main() {
981
976
982
977
check_diagnostics (
983
978
r#"
984
- trait T { fn a(); }
985
- struct U {}
986
- impl T for U {
987
- fn a() {
988
- // this comes out of bitflags, mostly
989
- #[allow(non_snake_case)]
990
- trait __BitFlags {
991
- const HiImAlsoBad: u8 = 2;
992
- #[inline]
993
- fn Dirty(&self) -> bool {
994
- false
979
+ trait T { fn a(); }
980
+ struct U {}
981
+ impl T for U {
982
+ fn a() {
983
+ // this comes out of bitflags, mostly
984
+ #[allow(non_snake_case)]
985
+ trait __BitFlags {
986
+ const HiImAlsoBad: u8 = 2;
987
+ #[inline]
988
+ fn Dirty(&self) -> bool {
989
+ false
990
+ }
995
991
}
992
+
996
993
}
994
+ }
995
+ "# ,
996
+ ) ;
997
+ }
997
998
999
+ #[ test]
1000
+ #[ ignore]
1001
+ fn bug_traits_arent_checked ( ) {
1002
+ // FIXME: Traits and functions in traits aren't currently checked by
1003
+ // r-a, even though rustc will complain about them.
1004
+ check_diagnostics (
1005
+ r#"
1006
+ trait BAD_TRAIT {
1007
+ // ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
1008
+ fn BAD_FUNCTION();
1009
+ // ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
1010
+ fn BadFunction();
1011
+ // ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function`
998
1012
}
999
- } "#,
1013
+ "#,
1000
1014
) ;
1001
1015
}
1002
1016
@@ -1006,10 +1020,10 @@ impl T for U {
1006
1020
cov_mark:: check!( extern_static_incorrect_case_ignored) ;
1007
1021
check_diagnostics (
1008
1022
r#"
1009
- extern {
1010
- fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1011
- pub static SomeStatic: u8 = 10;
1012
- }
1023
+ extern {
1024
+ fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1025
+ pub static SomeStatic: u8 = 10;
1026
+ }
1013
1027
"# ,
1014
1028
) ;
1015
1029
}
0 commit comments