Merge pull request #1757 from topecongiro/rfc/combine-array

Rfc: Combine Array
This commit is contained in:
Nick Cameron 2017-07-04 18:22:32 +12:00 committed by GitHub
commit 2400f39f98
4 changed files with 38 additions and 43 deletions

View File

@ -2404,9 +2404,10 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l
context.use_block_indent() || context.use_block_indent() ||
context.config.fn_call_style() == IndentStyle::Visual && args_len > 1 context.config.fn_call_style() == IndentStyle::Visual && args_len > 1
} }
ast::ExprKind::Array(..) |
ast::ExprKind::Call(..) | ast::ExprKind::Call(..) |
ast::ExprKind::MethodCall(..) |
ast::ExprKind::Mac(..) | ast::ExprKind::Mac(..) |
ast::ExprKind::MethodCall(..) |
ast::ExprKind::Struct(..) | ast::ExprKind::Struct(..) |
ast::ExprKind::Tup(..) => context.use_block_indent() && args_len == 1, ast::ExprKind::Tup(..) => context.use_block_indent() && args_len == 1,
ast::ExprKind::AddrOf(_, ref expr) | ast::ExprKind::AddrOf(_, ref expr) |

View File

@ -96,14 +96,12 @@ fn arrays() {
1, 1,
]; ];
let a = WeightedChoice::new( let a = WeightedChoice::new(&mut [
&mut [ Weighted { weight: x, item: 0 },
Weighted { weight: x, item: 0 }, Weighted { weight: 1, item: 1 },
Weighted { weight: 1, item: 1 }, Weighted { weight: x, item: 2 },
Weighted { weight: x, item: 2 }, Weighted { weight: 1, item: 3 },
Weighted { weight: 1, item: 3 }, ]);
],
);
let z = [ let z = [
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,

View File

@ -224,26 +224,24 @@ fn arrays() {
1, 1,
]; ];
let a = WeightedChoice::new( let a = WeightedChoice::new(&mut [
&mut [ Weighted {
Weighted { weightweight: x,
weightweight: x, item: 0,
item: 0, },
}, Weighted {
Weighted { weightweight: 1,
weightweight: 1, item: 1,
item: 1, },
}, Weighted {
Weighted { weightweight: x,
weightweight: x, item: 2,
item: 2, },
}, Weighted {
Weighted { weightweight: 1,
weightweight: 1, item: 3,
item: 3, },
}, ]);
],
);
let z = [ let z = [
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,

View File

@ -62,20 +62,18 @@ fn issue550() {
fn issue775() { fn issue775() {
if indent { if indent {
let a = mk_object( let a = mk_object(&[
&[ ("a".to_string(), Boolean(true)),
("a".to_string(), Boolean(true)), (
( "b".to_string(),
"b".to_string(), Array(vec![
Array(vec![ mk_object(
mk_object( &[("c".to_string(), String("\x0c\r".to_string()))],
&[("c".to_string(), String("\x0c\r".to_string()))], ),
), mk_object(&[("d".to_string(), String("".to_string()))]),
mk_object(&[("d".to_string(), String("".to_string()))]), ]),
]), ),
), ]);
],
);
} }
} }