Skip to content

Commit 74807b1

Browse files
committed
syntax: match variants use 4 space indent by default
1 parent 11f5f73 commit 74807b1

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ pub fn rust_printer(writer: @io::Writer, intr: @ident_interner) -> @ps {
9595
}
9696

9797
pub static indent_unit: uint = 4u;
98-
pub static match_indent_unit: uint = 2u;
9998

10099
pub static default_columns: uint = 78u;
101100

@@ -1227,16 +1226,16 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12271226
print_block(s, blk);
12281227
}
12291228
ast::expr_match(expr, ref arms) => {
1230-
cbox(s, match_indent_unit);
1229+
cbox(s, indent_unit);
12311230
ibox(s, 4);
12321231
word_nbsp(s, ~"match");
12331232
print_expr(s, expr);
12341233
space(s.s);
12351234
bopen(s);
1236-
let len = (*arms).len();
1237-
for (*arms).eachi |i, arm| {
1235+
let len = arms.len();
1236+
for arms.eachi |i, arm| {
12381237
space(s.s);
1239-
cbox(s, match_indent_unit);
1238+
cbox(s, indent_unit);
12401239
ibox(s, 0u);
12411240
let mut first = true;
12421241
for arm.pats.each |p| {
@@ -1269,7 +1268,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12691268
ast::expr_block(ref blk) => {
12701269
// the block will close the pattern's ibox
12711270
print_block_unclosed_indent(
1272-
s, blk, match_indent_unit);
1271+
s, blk, indent_unit);
12731272
}
12741273
_ => {
12751274
end(s); // close the ibox for the pattern
@@ -1286,10 +1285,10 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12861285
}
12871286
} else {
12881287
// the block will close the pattern's ibox
1289-
print_block_unclosed_indent(s, &arm.body, match_indent_unit);
1288+
print_block_unclosed_indent(s, &arm.body, indent_unit);
12901289
}
12911290
}
1292-
bclose_(s, expr.span, match_indent_unit);
1291+
bclose_(s, expr.span, indent_unit);
12931292
}
12941293
ast::expr_fn_block(ref decl, ref body) => {
12951294
// in do/for blocks we don't want to show an empty

src/test/pretty/alt-naked-expr-long.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ fn main() {
1717
let x = Some(3);
1818
let y =
1919
match x {
20-
Some(_) =>
21-
~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very"
22-
+ ~"very" + ~"very" + ~"long" + ~"string",
23-
None => ~"none"
20+
Some(_) =>
21+
~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" +
22+
~"very" + ~"very" + ~"very" + ~"long" + ~"string",
23+
None => ~"none"
2424
};
2525
}

src/test/pretty/alt-naked-expr-medium.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let x = Some(3);
1515
let _y =
1616
match x {
17-
Some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"],
18-
None => ~[~"none"]
17+
Some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"],
18+
None => ~[~"none"]
1919
};
2020
}

0 commit comments

Comments
 (0)