summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2019-12-20 19:07:50 +0000
committerNadrieril2019-12-20 19:07:50 +0000
commit08593ae84ceae4d5f639d5868c08b99f1622795a (patch)
treeb9eb77cc084f89c86488bcafe80b2c3ce591b07c /dhall/src
parent980e50f33a88559edcf8b12cdec91fd9bee84ca9 (diff)
Remove Expr::as_mut
Diffstat (limited to '')
-rw-r--r--dhall/src/syntax/ast/expr.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs
index 410fb1d..48c48d8 100644
--- a/dhall/src/syntax/ast/expr.rs
+++ b/dhall/src/syntax/ast/expr.rs
@@ -235,9 +235,6 @@ impl<E> Expr<E> {
pub fn as_ref(&self) -> &UnspannedExpr<E> {
&self.kind
}
- pub fn as_mut(&mut self) -> &mut UnspannedExpr<E> {
- &mut self.kind
- }
pub fn span(&self) -> Span {
self.span.clone()
}
@@ -264,7 +261,7 @@ impl<E> Expr<E> {
E: Clone,
F1: FnMut(Import<Expr<E>>) -> Result<E, Err>,
{
- match self.as_mut() {
+ match self.kind.as_mut() {
ExprKind::BinOp(BinOp::ImportAlt, l, r) => {
let garbage_expr = ExprKind::BoolLit(false);
let new_self = if l.traverse_resolve_mut(f).is_ok() {
@@ -273,12 +270,12 @@ impl<E> Expr<E> {
r.traverse_resolve_mut(f)?;
r
};
- *self.as_mut() =
- std::mem::replace(new_self.as_mut(), garbage_expr);
+ *self.kind =
+ std::mem::replace(new_self.kind.as_mut(), garbage_expr);
}
_ => {
- self.as_mut().traverse_mut(|e| e.traverse_resolve_mut(f))?;
- if let ExprKind::Import(import) = self.as_mut() {
+ self.kind.traverse_mut(|e| e.traverse_resolve_mut(f))?;
+ if let ExprKind::Import(import) = self.kind.as_mut() {
let garbage_import = Import {
mode: ImportMode::Code,
location: ImportLocation::Missing,
@@ -286,7 +283,7 @@ impl<E> Expr<E> {
};
// Move out of &mut import
let import = std::mem::replace(import, garbage_import);
- *self.as_mut() = ExprKind::Embed(f(import)?);
+ *self.kind = ExprKind::Embed(f(import)?);
}
}
}