mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
chore(cli,ext,rt): remove some unnecessary clone
or malloc
(#17261)
This commit is contained in:
parent
2da882137e
commit
319f607476
6 changed files with 23 additions and 18 deletions
|
@ -340,9 +340,9 @@ impl Diagnostics {
|
|||
/// returns `true` are included.
|
||||
pub fn filter<P>(&self, predicate: P) -> Self
|
||||
where
|
||||
P: FnMut(&Diagnostic) -> bool,
|
||||
P: FnMut(&Diagnostic) -> Option<Diagnostic>,
|
||||
{
|
||||
let diagnostics = self.0.clone().into_iter().filter(predicate).collect();
|
||||
let diagnostics = self.0.iter().filter_map(predicate).collect();
|
||||
Self(diagnostics)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue