From 30ce8b20ec70e8eb5d2203c4dbf104f57dfca49b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 9 Apr 2021 22:52:13 +0200 Subject: Avoid an unnecessary `collect` --- crates/hir_def/src/attr.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crates/hir_def/src') diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index dd99c8d15..786fad6e1 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -751,9 +751,7 @@ fn collect_attrs( .chain(inner_docs.into_iter().flatten()) .map(|docs_text| (docs_text.syntax().text_range().start(), Either::Right(docs_text))); // sort here by syntax node offset because the source can have doc attributes and doc strings be interleaved - let attrs: Vec<_> = docs.chain(attrs).sorted_by_key(|&(offset, _)| offset).collect(); - - attrs.into_iter().map(|(_, attr)| attr) + docs.chain(attrs).sorted_by_key(|&(offset, _)| offset).map(|(_, attr)| attr) } pub(crate) fn variants_attrs_source_map( -- cgit v1.2.3