From c8cad76d25f7fab856c9646b70122e0f9f7d7218 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 11 Aug 2020 00:55:57 +0300 Subject: Improve the ide diagnostics trait API --- crates/ra_hir_expand/src/diagnostics.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_expand/src') diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs index 8358c488b..e58defa68 100644 --- a/crates/ra_hir_expand/src/diagnostics.rs +++ b/crates/ra_hir_expand/src/diagnostics.rs @@ -72,9 +72,12 @@ impl<'a> DiagnosticSinkBuilder<'a> { self } - pub fn on Option<()> + 'a>(mut self, mut cb: F) -> Self { + pub fn on(mut self, mut cb: F) -> Self { let cb = move |diag: &dyn Diagnostic| match diag.as_any().downcast_ref::() { - Some(d) => cb(d).ok_or(()), + Some(d) => { + cb(d); + Ok(()) + } None => Err(()), }; self.callbacks.push(Box::new(cb)); -- cgit v1.2.3