aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-13 13:13:35 +0100
committerJonas Schievink <[email protected]>2021-04-13 13:13:35 +0100
commit31594bcd0196fbd2bff510bbe3d40678b390e696 (patch)
tree0a01c57a30739fc9bb9b8217c1ce9f7f0b851739 /crates/hir_ty
parent9beed98f2ab15f6d62283d09b6b96fa5f57a78d1 (diff)
decl_check: follow test style guide
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs119
1 files changed, 59 insertions, 60 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index fb0fc4c91..075dc4131 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -899,44 +899,44 @@ fn main() {
899 fn allow_attributes() { 899 fn allow_attributes() {
900 check_diagnostics( 900 check_diagnostics(
901 r#" 901 r#"
902 #[allow(non_snake_case)] 902#[allow(non_snake_case)]
903 fn NonSnakeCaseName(SOME_VAR: u8) -> u8{ 903fn NonSnakeCaseName(SOME_VAR: u8) -> u8{
904 // cov_flags generated output from elsewhere in this file 904 // cov_flags generated output from elsewhere in this file
905 extern "C" { 905 extern "C" {
906 #[no_mangle] 906 #[no_mangle]
907 static lower_case: u8; 907 static lower_case: u8;
908 }
909
910 let OtherVar = SOME_VAR + 1;
911 OtherVar
912 } 908 }
913 909
914 #[allow(nonstandard_style)] 910 let OtherVar = SOME_VAR + 1;
915 mod CheckNonstandardStyle { 911 OtherVar
916 fn HiImABadFnName() {} 912}
917 }
918 913
919 #[allow(bad_style)] 914#[allow(nonstandard_style)]
920 mod CheckBadStyle { 915mod CheckNonstandardStyle {
921 fn HiImABadFnName() {} 916 fn HiImABadFnName() {}
922 } 917}
923 918
924 mod F { 919#[allow(bad_style)]
925 #![allow(non_snake_case)] 920mod CheckBadStyle {
926 fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {} 921 fn HiImABadFnName() {}
927 } 922}
928 923
929 #[allow(non_snake_case, non_camel_case_types)] 924mod F {
930 pub struct some_type { 925 #![allow(non_snake_case)]
931 SOME_FIELD: u8, 926 fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
932 SomeField: u16, 927}
933 }
934 928
935 #[allow(non_upper_case_globals)] 929#[allow(non_snake_case, non_camel_case_types)]
936 pub const some_const: u8 = 10; 930pub struct some_type {
931 SOME_FIELD: u8,
932 SomeField: u16,
933}
937 934
938 #[allow(non_upper_case_globals)] 935#[allow(non_upper_case_globals)]
939 pub static SomeStatic: u8 = 10; 936pub const some_const: u8 = 10;
937
938#[allow(non_upper_case_globals)]
939pub static SomeStatic: u8 = 10;
940 "#, 940 "#,
941 ); 941 );
942 } 942 }
@@ -945,12 +945,11 @@ fn main() {
945 fn allow_attributes_crate_attr() { 945 fn allow_attributes_crate_attr() {
946 check_diagnostics( 946 check_diagnostics(
947 r#" 947 r#"
948 #![allow(non_snake_case)] 948#![allow(non_snake_case)]
949
950 mod F {
951 fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
952 }
953 949
950mod F {
951 fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
952}
954 "#, 953 "#,
955 ); 954 );
956 } 955 }
@@ -976,22 +975,22 @@ fn main() {
976 975
977 check_diagnostics( 976 check_diagnostics(
978 r#" 977 r#"
979 trait T { fn a(); } 978trait T { fn a(); }
980 struct U {} 979struct U {}
981 impl T for U { 980impl T for U {
982 fn a() { 981 fn a() {
983 // this comes out of bitflags, mostly 982 // this comes out of bitflags, mostly
984 #[allow(non_snake_case)] 983 #[allow(non_snake_case)]
985 trait __BitFlags { 984 trait __BitFlags {
986 const HiImAlsoBad: u8 = 2; 985 const HiImAlsoBad: u8 = 2;
987 #[inline] 986 #[inline]
988 fn Dirty(&self) -> bool { 987 fn Dirty(&self) -> bool {
989 false 988 false
990 }
991 } 989 }
992
993 } 990 }
991
994 } 992 }
993}
995 "#, 994 "#,
996 ); 995 );
997 } 996 }
@@ -1003,13 +1002,13 @@ fn main() {
1003 // r-a, even though rustc will complain about them. 1002 // r-a, even though rustc will complain about them.
1004 check_diagnostics( 1003 check_diagnostics(
1005 r#" 1004 r#"
1006 trait BAD_TRAIT { 1005trait BAD_TRAIT {
1007 // ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait` 1006 // ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
1008 fn BAD_FUNCTION(); 1007 fn BAD_FUNCTION();
1009 // ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function` 1008 // ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
1010 fn BadFunction(); 1009 fn BadFunction();
1011 // ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function` 1010 // ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function`
1012 } 1011}
1013 "#, 1012 "#,
1014 ); 1013 );
1015 } 1014 }
@@ -1020,10 +1019,10 @@ fn main() {
1020 cov_mark::check!(extern_static_incorrect_case_ignored); 1019 cov_mark::check!(extern_static_incorrect_case_ignored);
1021 check_diagnostics( 1020 check_diagnostics(
1022 r#" 1021 r#"
1023 extern { 1022extern {
1024 fn NonSnakeCaseName(SOME_VAR: u8) -> u8; 1023 fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1025 pub static SomeStatic: u8 = 10; 1024 pub static SomeStatic: u8 = 10;
1026 } 1025}
1027 "#, 1026 "#,
1028 ); 1027 );
1029 } 1028 }