From 18a63dd977ade20e17d41c08acbefde6eada8572 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 30 Nov 2021 09:23:30 +1100 Subject: feat: add `--no-check=remote` flag (#12766) Closes #11970 --- cli/diagnostics.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli/diagnostics.rs') diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs index b9e8c7463..0671dc500 100644 --- a/cli/diagnostics.rs +++ b/cli/diagnostics.rs @@ -367,6 +367,16 @@ impl Diagnostics { })); } + /// Return a set of diagnostics where only the values where the predicate + /// returns `true` are included. + pub fn filter

(&self, predicate: P) -> Self + where + P: FnMut(&Diagnostic) -> bool, + { + let diagnostics = self.0.clone().into_iter().filter(predicate).collect(); + Self(diagnostics) + } + pub fn is_empty(&self) -> bool { self.0.is_empty() } -- cgit v1.2.3