diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-09 21:52:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-09 21:52:41 +0100 |
commit | 00cdbceb9d7afdabc82788a88df88c6eb1035839 (patch) | |
tree | 02fd9fd5dc8dd425e717d8237d622ef0336f3c05 /crates/hir_def/src | |
parent | 343b14f7e06f3ec82a15b3648ba229e03e0b0583 (diff) | |
parent | 30ce8b20ec70e8eb5d2203c4dbf104f57dfca49b (diff) |
Merge #8453
8453: Avoid an unnecessary `collect` r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/attr.rs | 4 |
1 files changed, 1 insertions, 3 deletions
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( | |||
751 | .chain(inner_docs.into_iter().flatten()) | 751 | .chain(inner_docs.into_iter().flatten()) |
752 | .map(|docs_text| (docs_text.syntax().text_range().start(), Either::Right(docs_text))); | 752 | .map(|docs_text| (docs_text.syntax().text_range().start(), Either::Right(docs_text))); |
753 | // sort here by syntax node offset because the source can have doc attributes and doc strings be interleaved | 753 | // 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(); | 754 | docs.chain(attrs).sorted_by_key(|&(offset, _)| offset).map(|(_, attr)| attr) |
755 | |||
756 | attrs.into_iter().map(|(_, attr)| attr) | ||
757 | } | 755 | } |
758 | 756 | ||
759 | pub(crate) fn variants_attrs_source_map( | 757 | pub(crate) fn variants_attrs_source_map( |