mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
missing match arms diagnostic
This commit is contained in:
parent
b7e5d94bda
commit
8c378af721
12 changed files with 1048 additions and 11 deletions
|
@ -101,6 +101,14 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
|
|||
fix,
|
||||
})
|
||||
})
|
||||
.on::<hir::diagnostics::MissingMatchArms, _>(|d| {
|
||||
res.borrow_mut().push(Diagnostic {
|
||||
range: d.highlight_range(),
|
||||
message: d.message(),
|
||||
severity: Severity::Error,
|
||||
fix: None,
|
||||
})
|
||||
})
|
||||
.on::<hir::diagnostics::MissingOkInTailExpr, _>(|d| {
|
||||
let node = d.ast(db);
|
||||
let replacement = format!("Ok({})", node.syntax());
|
||||
|
@ -291,7 +299,7 @@ mod tests {
|
|||
fn check_no_diagnostic(content: &str) {
|
||||
let (analysis, file_id) = single_file(content);
|
||||
let diagnostics = analysis.diagnostics(file_id).unwrap();
|
||||
assert_eq!(diagnostics.len(), 0);
|
||||
assert_eq!(diagnostics.len(), 0, "expected no diagnostic, found one");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue