Add tests, reformat expr
This commit is contained in:
parent
abdb693922
commit
106f7251fb
3 changed files with 32 additions and 3 deletions
13
src/expr.rs
13
src/expr.rs
|
@ -667,8 +667,11 @@ fn rewrite_match(context: &RewriteContext,
|
||||||
if !missed_str.is_empty() {
|
if !missed_str.is_empty() {
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
result.push_str(&arm_indent_str);
|
result.push_str(&arm_indent_str);
|
||||||
result.push_str(&rewrite_comment(&missed_str, false,
|
result.push_str(&rewrite_comment(&missed_str,
|
||||||
width, arm_indent, context.config));
|
false,
|
||||||
|
width,
|
||||||
|
arm_indent,
|
||||||
|
context.config));
|
||||||
}
|
}
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
result.push_str(&arm_indent_str);
|
result.push_str(&arm_indent_str);
|
||||||
|
@ -698,7 +701,11 @@ fn rewrite_match(context: &RewriteContext,
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
if last_comment.len() > 0 {
|
if last_comment.len() > 0 {
|
||||||
result.push_str(&arm_indent_str);
|
result.push_str(&arm_indent_str);
|
||||||
result.push_str(&rewrite_comment(&last_comment, false, width, arm_indent, context.config));
|
result.push_str(&rewrite_comment(&last_comment,
|
||||||
|
false,
|
||||||
|
width,
|
||||||
|
arm_indent,
|
||||||
|
context.config));
|
||||||
result.push('\n');
|
result.push('\n');
|
||||||
}
|
}
|
||||||
result.push_str(&(context.block_indent + context.overflow_indent).to_string(context.config));
|
result.push_str(&(context.block_indent + context.overflow_indent).to_string(context.config));
|
||||||
|
|
|
@ -130,6 +130,16 @@ fn issue184(source: &str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn matches() {
|
||||||
|
match 1 {
|
||||||
|
1 => 1, // foo
|
||||||
|
2 => 2,
|
||||||
|
// bar
|
||||||
|
3 => 3,
|
||||||
|
_ => 0 // baz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn arrays() {
|
fn arrays() {
|
||||||
let x = [0,
|
let x = [0,
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -167,6 +167,18 @@ fn issue184(source: &str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn matches() {
|
||||||
|
match 1 {
|
||||||
|
1 => 1,
|
||||||
|
// foo
|
||||||
|
2 => 2,
|
||||||
|
// bar
|
||||||
|
3 => 3,
|
||||||
|
_ => 0,
|
||||||
|
// baz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn arrays() {
|
fn arrays() {
|
||||||
let x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 7, 8, 9, 0, 1, 2, 3, 4,
|
let x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 7, 8, 9, 0, 1, 2, 3, 4,
|
||||||
5, 6, 7, 8, 9, 0];
|
5, 6, 7, 8, 9, 0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue