Skip to content

Commit 30ce8b2

Browse files
Avoid an unnecessary collect
1 parent 343b14f commit 30ce8b2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

crates/hir_def/src/attr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,7 @@ fn collect_attrs(
751751
.chain(inner_docs.into_iter().flatten())
752752
.map(|docs_text| (docs_text.syntax().text_range().start(), Either::Right(docs_text)));
753753
// sort here by syntax node offset because the source can have doc attributes and doc strings be interleaved
754-
let attrs: Vec<_> = docs.chain(attrs).sorted_by_key(|&(offset, _)| offset).collect();
755-
756-
attrs.into_iter().map(|(_, attr)| attr)
754+
docs.chain(attrs).sorted_by_key(|&(offset, _)| offset).map(|(_, attr)| attr)
757755
}
758756

759757
pub(crate) fn variants_attrs_source_map(

0 commit comments

Comments
 (0)