Skip to content

Commit 31594bc

Browse files
decl_check: follow test style guide
1 parent 9beed98 commit 31594bc

File tree

1 file changed

+59
-60
lines changed

1 file changed

+59
-60
lines changed

crates/hir_ty/src/diagnostics/decl_check.rs

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -899,44 +899,44 @@ fn main() {
899899
fn allow_attributes() {
900900
check_diagnostics(
901901
r#"
902-
#[allow(non_snake_case)]
903-
fn NonSnakeCaseName(SOME_VAR: u8) -> u8{
904-
// cov_flags generated output from elsewhere in this file
905-
extern "C" {
906-
#[no_mangle]
907-
static lower_case: u8;
908-
}
909-
910-
let OtherVar = SOME_VAR + 1;
911-
OtherVar
902+
#[allow(non_snake_case)]
903+
fn NonSnakeCaseName(SOME_VAR: u8) -> u8{
904+
// cov_flags generated output from elsewhere in this file
905+
extern "C" {
906+
#[no_mangle]
907+
static lower_case: u8;
912908
}
913909
914-
#[allow(nonstandard_style)]
915-
mod CheckNonstandardStyle {
916-
fn HiImABadFnName() {}
917-
}
910+
let OtherVar = SOME_VAR + 1;
911+
OtherVar
912+
}
918913
919-
#[allow(bad_style)]
920-
mod CheckBadStyle {
921-
fn HiImABadFnName() {}
922-
}
914+
#[allow(nonstandard_style)]
915+
mod CheckNonstandardStyle {
916+
fn HiImABadFnName() {}
917+
}
923918
924-
mod F {
925-
#![allow(non_snake_case)]
926-
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
927-
}
919+
#[allow(bad_style)]
920+
mod CheckBadStyle {
921+
fn HiImABadFnName() {}
922+
}
928923
929-
#[allow(non_snake_case, non_camel_case_types)]
930-
pub struct some_type {
931-
SOME_FIELD: u8,
932-
SomeField: u16,
933-
}
924+
mod F {
925+
#![allow(non_snake_case)]
926+
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
927+
}
934928
935-
#[allow(non_upper_case_globals)]
936-
pub const some_const: u8 = 10;
929+
#[allow(non_snake_case, non_camel_case_types)]
930+
pub struct some_type {
931+
SOME_FIELD: u8,
932+
SomeField: u16,
933+
}
937934
938-
#[allow(non_upper_case_globals)]
939-
pub static SomeStatic: u8 = 10;
935+
#[allow(non_upper_case_globals)]
936+
pub const some_const: u8 = 10;
937+
938+
#[allow(non_upper_case_globals)]
939+
pub static SomeStatic: u8 = 10;
940940
"#,
941941
);
942942
}
@@ -945,12 +945,11 @@ fn main() {
945945
fn allow_attributes_crate_attr() {
946946
check_diagnostics(
947947
r#"
948-
#![allow(non_snake_case)]
949-
950-
mod F {
951-
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
952-
}
948+
#![allow(non_snake_case)]
953949
950+
mod F {
951+
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
952+
}
954953
"#,
955954
);
956955
}
@@ -976,22 +975,22 @@ fn main() {
976975

977976
check_diagnostics(
978977
r#"
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-
}
978+
trait T { fn a(); }
979+
struct U {}
980+
impl T for U {
981+
fn a() {
982+
// this comes out of bitflags, mostly
983+
#[allow(non_snake_case)]
984+
trait __BitFlags {
985+
const HiImAlsoBad: u8 = 2;
986+
#[inline]
987+
fn Dirty(&self) -> bool {
988+
false
991989
}
992-
993990
}
991+
994992
}
993+
}
995994
"#,
996995
);
997996
}
@@ -1003,13 +1002,13 @@ fn main() {
10031002
// r-a, even though rustc will complain about them.
10041003
check_diagnostics(
10051004
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`
1012-
}
1005+
trait BAD_TRAIT {
1006+
// ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
1007+
fn BAD_FUNCTION();
1008+
// ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
1009+
fn BadFunction();
1010+
// ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function`
1011+
}
10131012
"#,
10141013
);
10151014
}
@@ -1020,10 +1019,10 @@ fn main() {
10201019
cov_mark::check!(extern_static_incorrect_case_ignored);
10211020
check_diagnostics(
10221021
r#"
1023-
extern {
1024-
fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1025-
pub static SomeStatic: u8 = 10;
1026-
}
1022+
extern {
1023+
fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
1024+
pub static SomeStatic: u8 = 10;
1025+
}
10271026
"#,
10281027
);
10291028
}

0 commit comments

Comments
 (0)