Update tests and cargo fmt
This commit is contained in:
parent
98c6f7b731
commit
48424ea765
9 changed files with 46 additions and 84 deletions
|
|
@ -1688,7 +1688,8 @@ Number of spaces per tab
|
|||
fn lorem() {
|
||||
let ipsum = dolor();
|
||||
let sit = vec![
|
||||
"amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
|
||||
"amet consectetur adipiscing elit amet",
|
||||
"consectetur adipiscing elit amet consectetur.",
|
||||
];
|
||||
}
|
||||
```
|
||||
|
|
@ -1699,7 +1700,8 @@ fn lorem() {
|
|||
fn lorem() {
|
||||
let ipsum = dolor();
|
||||
let sit = vec![
|
||||
"amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
|
||||
"amet consectetur adipiscing elit amet",
|
||||
"consectetur adipiscing elit amet consectetur.",
|
||||
];
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -127,13 +127,11 @@ fn rewrite_closure_with_block(
|
|||
}
|
||||
|
||||
let block = ast::Block {
|
||||
stmts: vec![
|
||||
ast::Stmt {
|
||||
id: ast::NodeId::new(0),
|
||||
node: ast::StmtKind::Expr(ptr::P(body.clone())),
|
||||
span: body.span,
|
||||
},
|
||||
],
|
||||
stmts: vec![ast::Stmt {
|
||||
id: ast::NodeId::new(0),
|
||||
node: ast::StmtKind::Expr(ptr::P(body.clone())),
|
||||
span: body.span,
|
||||
}],
|
||||
id: ast::NodeId::new(0),
|
||||
rules: ast::BlockCheckMode::Default,
|
||||
span: body.span,
|
||||
|
|
@ -300,13 +298,7 @@ pub fn rewrite_last_closure(
|
|||
_ => body,
|
||||
};
|
||||
let (prefix, extra_offset) = rewrite_closure_fn_decl(
|
||||
capture,
|
||||
movability,
|
||||
fn_decl,
|
||||
body,
|
||||
expr.span,
|
||||
context,
|
||||
shape,
|
||||
capture, movability, fn_decl, body, expr.span, context, shape,
|
||||
)?;
|
||||
// If the closure goes multi line before its body, do not overflow the closure.
|
||||
if prefix.contains('\n') {
|
||||
|
|
|
|||
|
|
@ -173,13 +173,7 @@ pub fn format_expr(
|
|||
},
|
||||
ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) => {
|
||||
closures::rewrite_closure(
|
||||
capture,
|
||||
movability,
|
||||
fn_decl,
|
||||
body,
|
||||
expr.span,
|
||||
context,
|
||||
shape,
|
||||
capture, movability, fn_decl, body, expr.span, context, shape,
|
||||
)
|
||||
}
|
||||
ast::ExprKind::Try(..)
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ fn scan_simple_git_diff() {
|
|||
Range {
|
||||
file: "src/ir/traversal.rs".to_owned(),
|
||||
range: [35, 43],
|
||||
}
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,18 +221,16 @@ mod test {
|
|||
let diff = make_diff(src, dest, 1);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
Mismatch {
|
||||
line_number: 2,
|
||||
line_number_orig: 2,
|
||||
lines: vec![
|
||||
Context("two".to_owned()),
|
||||
Resulting("three".to_owned()),
|
||||
Expected("trois".to_owned()),
|
||||
Context("four".to_owned()),
|
||||
],
|
||||
},
|
||||
]
|
||||
vec![Mismatch {
|
||||
line_number: 2,
|
||||
line_number_orig: 2,
|
||||
lines: vec![
|
||||
Context("two".to_owned()),
|
||||
Resulting("three".to_owned()),
|
||||
Expected("trois".to_owned()),
|
||||
Context("four".to_owned()),
|
||||
],
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -274,13 +272,11 @@ mod test {
|
|||
let diff = make_diff(src, dest, 0);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
Mismatch {
|
||||
line_number: 3,
|
||||
line_number_orig: 3,
|
||||
lines: vec![Resulting("three".to_owned()), Expected("trois".to_owned())],
|
||||
},
|
||||
]
|
||||
vec![Mismatch {
|
||||
line_number: 3,
|
||||
line_number_orig: 3,
|
||||
lines: vec![Resulting("three".to_owned()), Expected("trois".to_owned())],
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -291,13 +287,11 @@ mod test {
|
|||
let diff = make_diff(src, dest, 1);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
Mismatch {
|
||||
line_number: 5,
|
||||
line_number_orig: 5,
|
||||
lines: vec![Context("five".to_owned()), Expected("".to_owned())],
|
||||
},
|
||||
]
|
||||
vec![Mismatch {
|
||||
line_number: 5,
|
||||
line_number_orig: 5,
|
||||
lines: vec![Context("five".to_owned()), Expected("".to_owned())],
|
||||
}]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
tests/lib.rs
24
tests/lib.rs
|
|
@ -540,19 +540,17 @@ fn rustfmt_diff_make_diff_tests() {
|
|||
let diff = make_diff("a\nb\nc\nd", "a\ne\nc\nd", 3);
|
||||
assert_eq!(
|
||||
diff,
|
||||
vec![
|
||||
Mismatch {
|
||||
line_number: 1,
|
||||
line_number_orig: 1,
|
||||
lines: vec![
|
||||
DiffLine::Context("a".into()),
|
||||
DiffLine::Resulting("b".into()),
|
||||
DiffLine::Expected("e".into()),
|
||||
DiffLine::Context("c".into()),
|
||||
DiffLine::Context("d".into()),
|
||||
],
|
||||
},
|
||||
]
|
||||
vec![Mismatch {
|
||||
line_number: 1,
|
||||
line_number_orig: 1,
|
||||
lines: vec![
|
||||
DiffLine::Context("a".into()),
|
||||
DiffLine::Resulting("b".into()),
|
||||
DiffLine::Expected("e".into()),
|
||||
DiffLine::Context("c".into()),
|
||||
DiffLine::Context("d".into()),
|
||||
],
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -233,10 +233,7 @@ impl Foo {
|
|||
if let Some(mi) = attr.meta() {
|
||||
if let Some(value) = mi.value_str() {
|
||||
doc_strings.push(DocFragment::Include(
|
||||
line,
|
||||
attr.span,
|
||||
filename,
|
||||
contents,
|
||||
line, attr.span, filename, contents,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,19 +114,7 @@ fn function_calls() {
|
|||
|
||||
fn macros() {
|
||||
baz!(
|
||||
do_not,
|
||||
add,
|
||||
trailing,
|
||||
commas,
|
||||
inside,
|
||||
of,
|
||||
function,
|
||||
like,
|
||||
macros,
|
||||
even,
|
||||
if_they,
|
||||
are,
|
||||
long
|
||||
do_not, add, trailing, commas, inside, of, function, like, macros, even, if_they, are, long
|
||||
);
|
||||
|
||||
baz!(one_item_macro_which_is_also_loooooooooooooooooooooooooooooooooooooooooooooooong);
|
||||
|
|
|
|||
|
|
@ -218,10 +218,7 @@ fn issue355() {
|
|||
xc => vec![1, 2], // comment
|
||||
yc => vec![3; 4], // comment
|
||||
yd => looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func(
|
||||
aaaaaaaaaa,
|
||||
bbbbbbbbbb,
|
||||
cccccccccc,
|
||||
dddddddddd,
|
||||
aaaaaaaaaa, bbbbbbbbbb, cccccccccc, dddddddddd,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue