diff options
author | Shotaro Yamada <[email protected]> | 2019-10-14 11:50:12 +0100 |
---|---|---|
committer | Shotaro Yamada <[email protected]> | 2019-10-14 11:50:12 +0100 |
commit | 3a55b5bf01ddc581a3f00fa56db725db93a131c6 (patch) | |
tree | b3cbc2d477141507f76f5f973daa9fb5545bd731 /crates/ra_hir/src/ty.rs | |
parent | b462eb96b867cd38c60fb3d94ffd7688cec70f21 (diff) |
make_mut_slice
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index bf7445ea3..cc9746f6d 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -17,7 +17,7 @@ use std::sync::Arc; | |||
17 | use std::{fmt, iter, mem}; | 17 | use std::{fmt, iter, mem}; |
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | db::HirDatabase, expr::ExprId, type_ref::Mutability, util::make_mut_arc_slice, Adt, Crate, | 20 | db::HirDatabase, expr::ExprId, type_ref::Mutability, util::make_mut_slice, Adt, Crate, |
21 | DefWithBody, GenericParams, HasGenericParams, Name, Trait, TypeAlias, | 21 | DefWithBody, GenericParams, HasGenericParams, Name, Trait, TypeAlias, |
22 | }; | 22 | }; |
23 | use display::{HirDisplay, HirFormatter}; | 23 | use display::{HirDisplay, HirFormatter}; |
@@ -308,11 +308,9 @@ impl Substs { | |||
308 | } | 308 | } |
309 | 309 | ||
310 | pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { | 310 | pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { |
311 | make_mut_arc_slice(&mut self.0, |s| { | 311 | for t in make_mut_slice(&mut self.0) { |
312 | for t in s { | 312 | t.walk_mut(f); |
313 | t.walk_mut(f); | 313 | } |
314 | } | ||
315 | }); | ||
316 | } | 314 | } |
317 | 315 | ||
318 | pub fn as_single(&self) -> &Ty { | 316 | pub fn as_single(&self) -> &Ty { |
@@ -538,11 +536,9 @@ impl TypeWalk for FnSig { | |||
538 | } | 536 | } |
539 | 537 | ||
540 | fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { | 538 | fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { |
541 | make_mut_arc_slice(&mut self.params_and_return, |s| { | 539 | for t in make_mut_slice(&mut self.params_and_return) { |
542 | for t in s { | 540 | t.walk_mut(f); |
543 | t.walk_mut(f); | 541 | } |
544 | } | ||
545 | }); | ||
546 | } | 542 | } |
547 | } | 543 | } |
548 | 544 | ||
@@ -752,11 +748,9 @@ impl TypeWalk for Ty { | |||
752 | p_ty.parameters.walk_mut(f); | 748 | p_ty.parameters.walk_mut(f); |
753 | } | 749 | } |
754 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 750 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |
755 | make_mut_arc_slice(predicates, |s| { | 751 | for p in make_mut_slice(predicates) { |
756 | for p in s { | 752 | p.walk_mut(f); |
757 | p.walk_mut(f); | 753 | } |
758 | } | ||
759 | }); | ||
760 | } | 754 | } |
761 | Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} | 755 | Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} |
762 | } | 756 | } |