decl_check: follow test style guide
This commit is contained in:
parent
9beed98f2a
commit
31594bcd01
1 changed files with 59 additions and 60 deletions
|
@ -899,8 +899,8 @@ fn main() {
|
||||||
fn allow_attributes() {
|
fn allow_attributes() {
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn NonSnakeCaseName(SOME_VAR: u8) -> u8{
|
fn NonSnakeCaseName(SOME_VAR: u8) -> u8{
|
||||||
// cov_flags generated output from elsewhere in this file
|
// cov_flags generated output from elsewhere in this file
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -909,34 +909,34 @@ fn main() {
|
||||||
|
|
||||||
let OtherVar = SOME_VAR + 1;
|
let OtherVar = SOME_VAR + 1;
|
||||||
OtherVar
|
OtherVar
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(nonstandard_style)]
|
#[allow(nonstandard_style)]
|
||||||
mod CheckNonstandardStyle {
|
mod CheckNonstandardStyle {
|
||||||
fn HiImABadFnName() {}
|
fn HiImABadFnName() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(bad_style)]
|
#[allow(bad_style)]
|
||||||
mod CheckBadStyle {
|
mod CheckBadStyle {
|
||||||
fn HiImABadFnName() {}
|
fn HiImABadFnName() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod F {
|
mod F {
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
|
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case, non_camel_case_types)]
|
#[allow(non_snake_case, non_camel_case_types)]
|
||||||
pub struct some_type {
|
pub struct some_type {
|
||||||
SOME_FIELD: u8,
|
SOME_FIELD: u8,
|
||||||
SomeField: u16,
|
SomeField: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const some_const: u8 = 10;
|
pub const some_const: u8 = 10;
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub static SomeStatic: u8 = 10;
|
pub static SomeStatic: u8 = 10;
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -945,12 +945,11 @@ fn main() {
|
||||||
fn allow_attributes_crate_attr() {
|
fn allow_attributes_crate_attr() {
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
mod F {
|
mod F {
|
||||||
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
|
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -976,9 +975,9 @@ fn main() {
|
||||||
|
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
trait T { fn a(); }
|
trait T { fn a(); }
|
||||||
struct U {}
|
struct U {}
|
||||||
impl T for U {
|
impl T for U {
|
||||||
fn a() {
|
fn a() {
|
||||||
// this comes out of bitflags, mostly
|
// this comes out of bitflags, mostly
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -991,7 +990,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1003,13 +1002,13 @@ fn main() {
|
||||||
// r-a, even though rustc will complain about them.
|
// r-a, even though rustc will complain about them.
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
trait BAD_TRAIT {
|
trait BAD_TRAIT {
|
||||||
// ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
|
// ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
|
||||||
fn BAD_FUNCTION();
|
fn BAD_FUNCTION();
|
||||||
// ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
|
// ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
|
||||||
fn BadFunction();
|
fn BadFunction();
|
||||||
// ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function`
|
// ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function`
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1020,10 +1019,10 @@ fn main() {
|
||||||
cov_mark::check!(extern_static_incorrect_case_ignored);
|
cov_mark::check!(extern_static_incorrect_case_ignored);
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
extern {
|
extern {
|
||||||
fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
|
fn NonSnakeCaseName(SOME_VAR: u8) -> u8;
|
||||||
pub static SomeStatic: u8 = 10;
|
pub static SomeStatic: u8 = 10;
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue