Update tests

This commit is contained in:
Seiichi Uchida 2018-09-19 23:19:24 +09:00
parent 829dbfabe9
commit 594774b4e5
12 changed files with 70 additions and 36 deletions

View File

@ -38,7 +38,8 @@ fn main() {
.method_call_a(aaaaa, bbbbb, |c| { .method_call_a(aaaaa, bbbbb, |c| {
let x = c; let x = c;
x x
}).method_call_b(aaaaa, bbbbb, |c| { })
.method_call_b(aaaaa, bbbbb, |c| {
let x = c; let x = c;
x x
}); });
@ -55,7 +56,8 @@ fn main() {
body.fold(Body::new(), |mut body, chunk| { body.fold(Body::new(), |mut body, chunk| {
body.extend(chunk); body.extend(chunk);
Ok(body) Ok(body)
}).and_then(move |body| { })
.and_then(move |body| {
let req = Request::from_parts(parts, body); let req = Request::from_parts(parts, body);
f(req).map_err(|_| io::Error::new(io::ErrorKind::Other, "")) f(req).map_err(|_| io::Error::new(io::ErrorKind::Other, ""))
}); });
@ -64,7 +66,8 @@ fn main() {
.map(|x| { .map(|x| {
x += 1; x += 1;
x x
}).filter(some_mod::some_filter) })
.filter(some_mod::some_filter)
} }
fn floaters() { fn floaters() {
@ -76,14 +79,16 @@ fn floaters() {
let x = Foo { let x = Foo {
field1: val1, field1: val1,
field2: val2, field2: val2,
}.method_call() }
.method_call()
.method_call(); .method_call();
let y = if cond { let y = if cond {
val1 val1
} else { } else {
val2 val2
}.method_call(); }
.method_call();
{ {
match x { match x {
@ -93,7 +98,8 @@ fn floaters() {
mparams[match cur.to_digit(10) { mparams[match cur.to_digit(10) {
Some(d) => d as usize - 1, Some(d) => d as usize - 1,
None => return Err("bad param number".to_owned()), None => return Err("bad param number".to_owned()),
}].clone(), }]
.clone(),
); );
} }
} }
@ -103,28 +109,34 @@ fn floaters() {
some(); some();
} else { } else {
none(); none();
}.bar() }
.bar()
.baz(); .baz();
Foo { Foo {
x: val, x: val,
}.baz(|| { }
.baz(|| {
force(); force();
multiline(); multiline();
}).quux(); })
.quux();
Foo { Foo {
y: i_am_multi_line, y: i_am_multi_line,
z: ok, z: ok,
}.baz(|| { }
.baz(|| {
force(); force();
multiline(); multiline();
}).quux(); })
.quux();
a + match x { a + match x {
true => "yay!", true => "yay!",
false => "boo!", false => "boo!",
}.bar() }
.bar()
} }
fn is_replaced_content() -> bool { fn is_replaced_content() -> bool {
@ -184,7 +196,8 @@ fn issue1392() {
else { else {
b(); b();
} }
"#.trim(), "#
.trim(),
); );
} }
@ -234,7 +247,8 @@ impl Foo {
} }
} }
}) })
}).collect(); })
.collect();
} }
} }
@ -247,8 +261,10 @@ fn issue2415() {
Ok((|| { Ok((|| {
// stuff // stuff
Some(value.to_string()) Some(value.to_string())
})().ok_or("")?) })()
})().unwrap_or_else(|_: Box<::std::error::Error>| String::from("")); .ok_or("")?)
})()
.unwrap_or_else(|_: Box<::std::error::Error>| String::from(""));
} }
impl issue_2786 { impl issue_2786 {
@ -256,10 +272,12 @@ impl issue_2786 {
foo(|a| { foo(|a| {
println!("a"); println!("a");
println!("b"); println!("b");
}).bar(|c| { })
.bar(|c| {
println!("a"); println!("a");
println!("b"); println!("b");
}).baz(|c| { })
.baz(|c| {
println!("a"); println!("a");
println!("b"); println!("b");
}) })
@ -271,10 +289,12 @@ fn issue_2773() {
bar.or_else(|| { bar.or_else(|| {
// do stuff // do stuff
None None
}).or_else(|| { })
.or_else(|| {
// do other stuff // do other stuff
None None
}).and_then(|val| { })
.and_then(|val| {
// do this stuff // do this stuff
None None
}); });

View File

@ -171,7 +171,8 @@ fn issue1329() {
.map(|x| { .map(|x| {
x += 1; x += 1;
x x
}).filter })
.filter
} }
fn issue325() { fn issue325() {

View File

@ -61,7 +61,8 @@ fn issue1420() {
# Getting started # Getting started
... ...
"#, "#,
).running(waltz) )
.running(waltz)
} }
// #1563 // #1563
@ -117,7 +118,8 @@ impl Cursor {
debug_assert_eq!(n, -1); debug_assert_eq!(n, -1);
None None
} }
}).or_else(|| { })
.or_else(|| {
let canonical = self.canonical(); let canonical = self.canonical();
if canonical != *self { if canonical != *self {
canonical.num_template_args() canonical.num_template_args()

View File

@ -141,7 +141,8 @@ fn issue_1450() {
Relaxed, Relaxed,
Release, Release,
Relaxed, Relaxed,
).is_ok() )
.is_ok()
{ {
return; return;
} }

View File

@ -4,7 +4,8 @@ fn floaters() {
let x = Foo { let x = Foo {
field1: val1, field1: val1,
field2: val2, field2: val2,
}.method_call() }
.method_call()
.method_call(); .method_call();
let y = if cond { let y = if cond {

View File

@ -4,7 +4,8 @@ fn floaters() {
let x = Foo { let x = Foo {
field1: val1, field1: val1,
field2: val2, field2: val2,
}.method_call() }
.method_call()
.method_call(); .method_call();
let y = if cond { val1 } else { val2 }.method_call(); let y = if cond { val1 } else { val2 }.method_call();

View File

@ -16,5 +16,6 @@ fn foo() {
Ok(entry.insert(try!(statement))) Ok(entry.insert(try!(statement)))
} }
} }
}).map(MaybeCached::Cached) })
.map(MaybeCached::Cached)
} }

View File

@ -55,7 +55,8 @@ fn bar() {}
/// .resource("/", |r| r.f(|r| HttpResponse::Ok())) /// .resource("/", |r| r.f(|r| HttpResponse::Ok()))
/// .boxed(), /// .boxed(),
/// ] /// ]
/// }).bind("127.0.0.1:8080") /// })
/// .bind("127.0.0.1:8080")
/// .unwrap() /// .unwrap()
/// .run() /// .run()
/// # }); /// # });

View File

@ -52,7 +52,8 @@ fn main() {
assert!(row_sum_a > 0); assert!(row_sum_a > 0);
(item_b, (item_a, num_cooccurrences, row_sum_a)) (item_b, (item_a, num_cooccurrences, row_sum_a))
}, },
).join_map( )
.join_map(
&row_sums, &row_sums,
|&item_b, &(item_a, num_cooccurrences, row_sum_a), &row_sum_b| { |&item_b, &(item_a, num_cooccurrences, row_sum_a), &row_sum_b| {
assert!(row_sum_a > 0); assert!(row_sum_a > 0);
@ -159,5 +160,6 @@ fn main() {
worker.step(); worker.step();
} }
} }
}).unwrap(); })
.unwrap();
} }

View File

@ -173,7 +173,8 @@ fn issue1739() {
.., ..,
init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1], init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1],
.. ..
]).par_map_inplace(|el| *el = 0.); ])
.par_map_inplace(|el| *el = 0.);
} }
fn issue_1885() { fn issue_1885() {
@ -183,7 +184,8 @@ fn issue_1885() {
chan_select! { chan_select! {
rx.recv() => {} rx.recv() => {}
} }
}).collect::<Vec<_>>(); })
.collect::<Vec<_>>();
} }
fn issue_1917() { fn issue_1917() {

View File

@ -381,7 +381,8 @@ fn issue1456() {
.iter() .iter()
.map(|node| { .map(|node| {
XPathNodeReader::new(node, &context).and_then(|r| ArtistRef::from_xml(&r)) XPathNodeReader::new(node, &context).and_then(|r| ArtistRef::from_xml(&r))
}).collect(); })
.collect();
res? res?
} }
_ => Vec::new(), _ => Vec::new(),

View File

@ -29,7 +29,8 @@ fn main() {
expr.rewrite( expr.rewrite(
inner_context, inner_context,
&Constraints::new(try_opt!(v_budget.checked_sub(2)), indent + 2), &Constraints::new(try_opt!(v_budget.checked_sub(2)), indent + 2),
).map(|s| format!("..{}", s)) )
.map(|s| format!("..{}", s))
} }
} }
}, },