diff options
Diffstat (limited to 'crates/ra_syntax/src/algo')
-rw-r--r-- | crates/ra_syntax/src/algo/visit.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_syntax/src/algo/visit.rs b/crates/ra_syntax/src/algo/visit.rs index 38f21594c..81a99228f 100644 --- a/crates/ra_syntax/src/algo/visit.rs +++ b/crates/ra_syntax/src/algo/visit.rs | |||
@@ -7,10 +7,7 @@ pub fn visitor<'a, T>() -> impl Visitor<'a, Output = T> { | |||
7 | } | 7 | } |
8 | 8 | ||
9 | pub fn visitor_ctx<'a, T, C>(ctx: C) -> impl VisitorCtx<'a, Output = T, Ctx = C> { | 9 | pub fn visitor_ctx<'a, T, C>(ctx: C) -> impl VisitorCtx<'a, Output = T, Ctx = C> { |
10 | EmptyVisitorCtx { | 10 | EmptyVisitorCtx { ph: PhantomData, ctx } |
11 | ph: PhantomData, | ||
12 | ctx, | ||
13 | } | ||
14 | } | 11 | } |
15 | 12 | ||
16 | pub trait Visitor<'a>: Sized { | 13 | pub trait Visitor<'a>: Sized { |
@@ -21,11 +18,7 @@ pub trait Visitor<'a>: Sized { | |||
21 | N: AstNode + 'a, | 18 | N: AstNode + 'a, |
22 | F: FnOnce(&'a N) -> Self::Output, | 19 | F: FnOnce(&'a N) -> Self::Output, |
23 | { | 20 | { |
24 | Vis { | 21 | Vis { inner: self, f, ph: PhantomData } |
25 | inner: self, | ||
26 | f, | ||
27 | ph: PhantomData, | ||
28 | } | ||
29 | } | 22 | } |
30 | } | 23 | } |
31 | 24 | ||
@@ -38,11 +31,7 @@ pub trait VisitorCtx<'a>: Sized { | |||
38 | N: AstNode + 'a, | 31 | N: AstNode + 'a, |
39 | F: FnOnce(&'a N, Self::Ctx) -> Self::Output, | 32 | F: FnOnce(&'a N, Self::Ctx) -> Self::Output, |
40 | { | 33 | { |
41 | VisCtx { | 34 | VisCtx { inner: self, f, ph: PhantomData } |
42 | inner: self, | ||
43 | f, | ||
44 | ph: PhantomData, | ||
45 | } | ||
46 | } | 35 | } |
47 | } | 36 | } |
48 | 37 | ||