Add diagnostics for enum names and variants

This commit is contained in:
Igor Aleksanov 2020-10-03 18:01:25 +03:00
parent e24e22f288
commit fb96bba878
3 changed files with 173 additions and 2 deletions

View file

@ -851,6 +851,32 @@ pub struct TestStruct { one: i32 }
pub fn some_fn(val: TestStruct) -> TestStruct {
TestStruct { one: val.one + 1 }
}
"#,
);
check_fixes(
r#"
pub fn some_fn(NonSnakeCase<|>: u8) -> u8 {
NonSnakeCase
}
"#,
r#"
pub fn some_fn(non_snake_case: u8) -> u8 {
non_snake_case
}
"#,
);
check_fixes(
r#"
pub fn SomeFn<|>(val: u8) -> u8 {
if val != 0 { SomeFn(val - 1) } else { val }
}
"#,
r#"
pub fn some_fn(val: u8) -> u8 {
if val != 0 { some_fn(val - 1) } else { val }
}
"#,
);
}