diff options
| author | Marcus Klaas <mail@marcusklaas.nl> | 2015-10-17 14:19:55 +0200 |
|---|---|---|
| committer | Marcus Klaas <mail@marcusklaas.nl> | 2015-10-17 16:05:59 +0200 |
| commit | 01937061a905d52d4893e31d64c5f8a7d2e5a044 (patch) | |
| tree | 391d82bad7f113ce636fb8a511a9ba92fbc773d5 /src/expr.rs | |
| parent | 00aa232834e112ec7f96cf8cd8b90c850f12e0d5 (diff) | |
Format more type variants
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/expr.rs b/src/expr.rs index db8e37c27e7..bd03ee6838e 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -161,10 +161,10 @@ impl Rewrite for ast::Expr { wrap_str("return".to_owned(), context.config.max_width, width, offset) } ast::Expr_::ExprRet(Some(ref expr)) => { - rewrite_unary_prefix(context, "return ", expr, width, offset) + rewrite_unary_prefix(context, "return ", &**expr, width, offset) } ast::Expr_::ExprBox(ref expr) => { - rewrite_unary_prefix(context, "box ", expr, width, offset) + rewrite_unary_prefix(context, "box ", &**expr, width, offset) } ast::Expr_::ExprAddrOf(mutability, ref expr) => { rewrite_expr_addrof(context, mutability, expr, width, offset) @@ -210,15 +210,15 @@ impl Rewrite for ast::Expr { } } -fn rewrite_pair<LHS, RHS>(lhs: &LHS, - rhs: &RHS, - prefix: &str, - infix: &str, - suffix: &str, - context: &RewriteContext, - width: usize, - offset: Indent) - -> Option<String> +pub fn rewrite_pair<LHS, RHS>(lhs: &LHS, + rhs: &RHS, + prefix: &str, + infix: &str, + suffix: &str, + context: &RewriteContext, + width: usize, + offset: Indent) + -> Option<String> where LHS: Rewrite, RHS: Rewrite { @@ -1470,16 +1470,16 @@ fn rewrite_binary_op(context: &RewriteContext, rhs_result)) } -fn rewrite_unary_prefix(context: &RewriteContext, - prefix: &str, - expr: &ast::Expr, - width: usize, - offset: Indent) - -> Option<String> { - expr.rewrite(context, - try_opt!(width.checked_sub(prefix.len())), - offset + prefix.len()) - .map(|r| format!("{}{}", prefix, r)) +pub fn rewrite_unary_prefix<R: Rewrite>(context: &RewriteContext, + prefix: &str, + rewrite: &R, + width: usize, + offset: Indent) + -> Option<String> { + rewrite.rewrite(context, + try_opt!(width.checked_sub(prefix.len())), + offset + prefix.len()) + .map(|r| format!("{}{}", prefix, r)) } fn rewrite_unary_op(context: &RewriteContext, |
