From 0183ea548ad9bd70dc4b0758be311b690be62834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Sun, 30 Oct 2022 15:00:01 +0100 Subject: [PATCH] Fix clippy::manual_retain --- components/content/src/utils.rs | 2 +- components/markdown/src/markdown.rs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/content/src/utils.rs b/components/content/src/utils.rs index d44959c10d..176b221016 100644 --- a/components/content/src/utils.rs +++ b/components/content/src/utils.rs @@ -45,7 +45,7 @@ pub fn find_related_assets(path: &Path, config: &Config, recursive: bool) -> Vec } if let Some(ref globset) = config.ignored_content_globset { - assets = assets.into_iter().filter(|p| !globset.is_match(p)).collect(); + assets.retain(|p| !globset.is_match(p)); } assets diff --git a/components/markdown/src/markdown.rs b/components/markdown/src/markdown.rs index 912eae3841..3d817b7813 100644 --- a/components/markdown/src/markdown.rs +++ b/components/markdown/src/markdown.rs @@ -482,13 +482,10 @@ pub fn markdown_to_html( } // We remove all the empty things we might have pushed before so we don't get some random \n - events = events - .into_iter() - .filter(|e| match e { - Event::Text(text) | Event::Html(text) => !text.is_empty(), - _ => true, - }) - .collect(); + events.retain(|e| match e { + Event::Text(text) | Event::Html(text) => !text.is_empty(), + _ => true, + }); let heading_refs = get_heading_refs(&events);