mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 13:36:49 +00:00
Merge #7022
7022: Prevent multiple incorrect case diagnostics in functions r=lnicola a=unexge Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6970 Co-authored-by: unexge <unexge@gmail.com>
This commit is contained in:
commit
01a3fd9600
@ -374,8 +374,6 @@ impl Module {
|
||||
let crate_def_map = db.crate_def_map(self.id.krate);
|
||||
crate_def_map.add_diagnostics(db.upcast(), self.id.local_id, sink);
|
||||
for decl in self.declarations(db) {
|
||||
decl.diagnostics(db, sink);
|
||||
|
||||
match decl {
|
||||
crate::ModuleDef::Function(f) => f.diagnostics(db, sink),
|
||||
crate::ModuleDef::Module(m) => {
|
||||
@ -384,7 +382,9 @@ impl Module {
|
||||
m.diagnostics(db, sink)
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
_ => {
|
||||
decl.diagnostics(db, sink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,4 +895,17 @@ impl TestStruct {
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() {
|
||||
let input = r#"fn FOO<|>() {}"#;
|
||||
let expected = r#"fn foo() {}"#;
|
||||
|
||||
let (analysis, file_position) = fixture::position(input);
|
||||
let diagnostics =
|
||||
analysis.diagnostics(&DiagnosticsConfig::default(), file_position.file_id).unwrap();
|
||||
assert_eq!(diagnostics.len(), 1);
|
||||
|
||||
check_fixes(input, expected);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user