Merge pull request #157 from marcusklaas/box-syntax
Preserve box syntax
This commit is contained in:
commit
0fc8c37836
@ -378,11 +378,13 @@ fn rewrite_unary_op(context: &RewriteContext,
|
||||
-> Option<String> {
|
||||
// For some reason, an UnOp is not spanned like BinOp!
|
||||
let operator_str = match *op {
|
||||
ast::UnOp::UnUniq => "&",
|
||||
ast::UnOp::UnUniq => "box ",
|
||||
ast::UnOp::UnDeref => "*",
|
||||
ast::UnOp::UnNot => "!",
|
||||
ast::UnOp::UnNeg => "-"
|
||||
};
|
||||
|
||||
Some(format!("{}{}", operator_str, try_opt!(expr.rewrite(context, width - 1, offset))))
|
||||
let subexpr = try_opt!(expr.rewrite(context, width - operator_str.len(), offset));
|
||||
|
||||
Some(format!("{}{}", operator_str, subexpr))
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Test expressions
|
||||
|
||||
fn foo() -> bool {
|
||||
let boxed: Box<i32> = box 5;
|
||||
let referenced = &5;
|
||||
|
||||
let very_long_variable_name = ( a + first + simple + test );
|
||||
let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB + b + c);
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Test expressions
|
||||
|
||||
fn foo() -> bool {
|
||||
let boxed: Box<i32> = box 5;
|
||||
let referenced = &5;
|
||||
|
||||
let very_long_variable_name = (a + first + simple + test);
|
||||
let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB +
|
||||
b + c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user