From 8c378af72117e92bc894fd4a79e978ef0d1c0cc7 Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Tue, 24 Mar 2020 04:40:58 -0700 Subject: missing match arms diagnostic --- crates/ra_ide/src/diagnostics.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide/src/diagnostics.rs') diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index c1d7ddaf2..901ad104c 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -101,6 +101,14 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec fix, }) }) + .on::(|d| { + res.borrow_mut().push(Diagnostic { + range: d.highlight_range(), + message: d.message(), + severity: Severity::Error, + fix: None, + }) + }) .on::(|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] -- cgit v1.2.3