diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-14 14:14:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-14 14:14:18 +0100 |
commit | e182825170e346abb84240b84458b49b73783dca (patch) | |
tree | 899e18326f89571f835a0d9eb2f42a71f714f2df /crates/ra_hir/src/ty/traits | |
parent | 1f4fbc0035a6a9ee1b599a3aa9f236989633a9f7 (diff) | |
parent | 3a55b5bf01ddc581a3f00fa56db725db93a131c6 (diff) |
Merge #2006
2006: Improvements around `Arc<[T]>` r=matklad a=sinkuu
First commit tries to avoid cloning `Arc<[T]>` to a temporary `Vec` for mutating it, if there are no other strong references. Second commit utilizes [`FromIterator for Arc<[T]>`](https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-FromIterator%3CT%3E) instead of `.collect::<Vec<_>>().into()` to avoid allocation in `From<Vec<T>> for Arc<[T]>`.
Co-authored-by: Shotaro Yamada <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 9168de709..00aaf65d9 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -126,8 +126,7 @@ impl ToChalk for Substs { | |||
126 | chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), | 126 | chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), |
127 | chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), | 127 | chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), |
128 | }) | 128 | }) |
129 | .collect::<Vec<_>>() | 129 | .collect(); |
130 | .into(); | ||
131 | Substs(tys) | 130 | Substs(tys) |
132 | } | 131 | } |
133 | } | 132 | } |