summaryrefslogtreecommitdiff
path: root/cli/diagnostics.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-11-30 09:23:30 +1100
committerGitHub <noreply@github.com>2021-11-30 09:23:30 +1100
commit18a63dd977ade20e17d41c08acbefde6eada8572 (patch)
treeba233cf2c4d7be978008f736f25a677d1e9dae8a /cli/diagnostics.rs
parentf3b74350da69cb8cc0aedb1c1570abe2c64741ba (diff)
feat: add `--no-check=remote` flag (#12766)
Closes #11970
Diffstat (limited to 'cli/diagnostics.rs')
-rw-r--r--cli/diagnostics.rs10
1 files changed, 10 insertions, 0 deletions
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<P>(&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()
}