From d402974aa0af6de290245a9d2a69a5d56c4fa610 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 18 Jul 2019 19:23:05 +0300 Subject: migrate ra_syntax to the new rowan API --- crates/ra_syntax/src/algo/visit.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_syntax/src/algo') diff --git a/crates/ra_syntax/src/algo/visit.rs b/crates/ra_syntax/src/algo/visit.rs index 81a99228f..87bd15cc0 100644 --- a/crates/ra_syntax/src/algo/visit.rs +++ b/crates/ra_syntax/src/algo/visit.rs @@ -16,7 +16,7 @@ pub trait Visitor<'a>: Sized { fn visit(self, f: F) -> Vis where N: AstNode + 'a, - F: FnOnce(&'a N) -> Self::Output, + F: FnOnce(N) -> Self::Output, { Vis { inner: self, f, ph: PhantomData } } @@ -29,7 +29,7 @@ pub trait VisitorCtx<'a>: Sized { fn visit(self, f: F) -> VisCtx where N: AstNode + 'a, - F: FnOnce(&'a N, Self::Ctx) -> Self::Output, + F: FnOnce(N, Self::Ctx) -> Self::Output, { VisCtx { inner: self, f, ph: PhantomData } } @@ -74,13 +74,13 @@ impl<'a, V, N, F> Visitor<'a> for Vis where V: Visitor<'a>, N: AstNode + 'a, - F: FnOnce(&'a N) -> >::Output, + F: FnOnce(N) -> >::Output, { type Output = >::Output; fn accept(self, node: &'a SyntaxNode) -> Option { let Vis { inner, f, .. } = self; - inner.accept(node).or_else(|| N::cast(node).map(f)) + inner.accept(node).or_else(|| N::cast(node.clone()).map(f)) } } @@ -95,14 +95,14 @@ impl<'a, V, N, F> VisitorCtx<'a> for VisCtx where V: VisitorCtx<'a>, N: AstNode + 'a, - F: FnOnce(&'a N, >::Ctx) -> >::Output, + F: FnOnce(N, >::Ctx) -> >::Output, { type Output = >::Output; type Ctx = >::Ctx; fn accept(self, node: &'a SyntaxNode) -> Result { let VisCtx { inner, f, .. } = self; - inner.accept(node).or_else(|ctx| match N::cast(node) { + inner.accept(node).or_else(|ctx| match N::cast(node.clone()) { None => Err(ctx), Some(node) => Ok(f(node, ctx)), }) -- cgit v1.2.3