aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs56
1 files changed, 35 insertions, 21 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index 31532f327..fb0fc4c91 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -926,11 +926,6 @@ fn main() {
926 fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {} 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 #[allow(non_snake_case, non_camel_case_types)] 929 #[allow(non_snake_case, non_camel_case_types)]
935 pub struct some_type { 930 pub struct some_type {
936 SOME_FIELD: u8, 931 SOME_FIELD: u8,
@@ -981,22 +976,41 @@ fn main() {
981 976
982 check_diagnostics( 977 check_diagnostics(
983 r#" 978 r#"
984trait T { fn a(); } 979 trait T { fn a(); }
985struct U {} 980 struct U {}
986impl T for U { 981 impl T for U {
987 fn a() { 982 fn a() {
988 // this comes out of bitflags, mostly 983 // this comes out of bitflags, mostly
989 #[allow(non_snake_case)] 984 #[allow(non_snake_case)]
990 trait __BitFlags { 985 trait __BitFlags {
991 const HiImAlsoBad: u8 = 2; 986 const HiImAlsoBad: u8 = 2;
992 #[inline] 987 #[inline]
993 fn Dirty(&self) -> bool { 988 fn Dirty(&self) -> bool {
994 false 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 cov_mark::check!(extern_static_incorrect_case_ignored); 1020 cov_mark::check!(extern_static_incorrect_case_ignored);
1007 check_diagnostics( 1021 check_diagnostics(
1008 r#" 1022 r#"
1009extern { 1023 extern {
1010 fn NonSnakeCaseName(SOME_VAR: u8) -> u8; 1024 fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1011 pub static SomeStatic: u8 = 10; 1025 pub static SomeStatic: u8 = 10;
1012} 1026 }
1013 "#, 1027 "#,
1014 ); 1028 );
1015 } 1029 }