Skip to content

Commit 26d2653

Browse files
committed
address review feedback
1 parent 4529f1b commit 26d2653

File tree

1 file changed

+35
-21
lines changed

1 file changed

+35
-21
lines changed

crates/hir_ty/src/diagnostics/decl_check.rs

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -926,11 +926,6 @@ fn main() {
926926
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
927927
}
928928
929-
trait BAD_TRAIT {
930-
fn BAD_FUNCTION();
931-
fn BadFunction();
932-
}
933-
934929
#[allow(non_snake_case, non_camel_case_types)]
935930
pub struct some_type {
936931
SOME_FIELD: u8,
@@ -981,22 +976,41 @@ fn main() {
981976

982977
check_diagnostics(
983978
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+
}
995991
}
992+
996993
}
994+
}
995+
"#,
996+
);
997+
}
997998

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`
9981012
}
999-
}"#,
1013+
"#,
10001014
);
10011015
}
10021016

@@ -1006,10 +1020,10 @@ impl T for U {
10061020
cov_mark::check!(extern_static_incorrect_case_ignored);
10071021
check_diagnostics(
10081022
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+
}
10131027
"#,
10141028
);
10151029
}

0 commit comments

Comments
 (0)