mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Update tests
This commit is contained in:
parent
a9f529cba4
commit
62d200d9cf
@ -201,8 +201,9 @@ fn print_mismatches(result: HashMap<String, Vec<Mismatch>>) {
|
||||
let mut t = term::stdout().unwrap();
|
||||
|
||||
for (file_name, diff) in result {
|
||||
print_diff(diff,
|
||||
|line_num| format!("\nMismatch at {}:{}:", file_name, line_num));
|
||||
print_diff(diff, |line_num| {
|
||||
format!("\nMismatch at {}:{}:", file_name, line_num)
|
||||
});
|
||||
}
|
||||
|
||||
t.reset().unwrap();
|
||||
|
@ -147,12 +147,9 @@ fn try_shorthand() {
|
||||
.0
|
||||
.x;
|
||||
|
||||
parameterized(f,
|
||||
substs,
|
||||
def_id,
|
||||
Ns::Value,
|
||||
&[],
|
||||
|tcx| tcx.lookup_item_type(def_id).generics)?;
|
||||
parameterized(f, substs, def_id, Ns::Value, &[], |tcx| {
|
||||
tcx.lookup_item_type(def_id).generics
|
||||
})?;
|
||||
fooooooooooooooooooooooooooo()?
|
||||
.bar()?
|
||||
.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?;
|
||||
|
120
tests/target/combining.rs
Normal file
120
tests/target/combining.rs
Normal file
@ -0,0 +1,120 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
||||
|
||||
fn main() {
|
||||
// Call
|
||||
foo(bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Mac
|
||||
foo(foo!(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// MethodCall
|
||||
foo(x.foo::<Bar, Baz>(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Block
|
||||
foo!({
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// Closure
|
||||
foo(|x| {
|
||||
let y = x + 1;
|
||||
y
|
||||
});
|
||||
|
||||
// Match
|
||||
foo(match opt {
|
||||
Some(x) => x,
|
||||
None => y,
|
||||
});
|
||||
|
||||
// Struct
|
||||
foo(Bar {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
});
|
||||
|
||||
// If
|
||||
foo!(if x {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
});
|
||||
|
||||
// IfLet
|
||||
foo!(if let Some(..) = x {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
});
|
||||
|
||||
// While
|
||||
foo!(while x {
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// WhileLet
|
||||
foo!(while let Some(..) = x {
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// ForLoop
|
||||
foo!(for x in y {
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// Loop
|
||||
foo!(loop {
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// Tuple
|
||||
foo((
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// AddrOf
|
||||
foo(&bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Box
|
||||
foo(box Bar {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
});
|
||||
|
||||
// Unary
|
||||
foo(!bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Try
|
||||
foo(bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
)?);
|
||||
|
||||
// Cast
|
||||
foo(Bar {
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
} as i64);
|
||||
}
|
@ -134,15 +134,14 @@ impl Cursor {
|
||||
}
|
||||
|
||||
fn issue1581() {
|
||||
bootstrap.checks.register(
|
||||
"PERSISTED_LOCATIONS",
|
||||
move || if locations2.0.inner_mut.lock().poisoned {
|
||||
bootstrap.checks.register("PERSISTED_LOCATIONS", move || {
|
||||
if locations2.0.inner_mut.lock().poisoned {
|
||||
Check::new(
|
||||
State::Error,
|
||||
"Persisted location storage is poisoned due to a write failure",
|
||||
)
|
||||
} else {
|
||||
Check::new(State::Healthy, "Persisted location storage is healthy")
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ fn main() {
|
||||
}
|
||||
|
||||
loong_func().quux(move || if true {
|
||||
1
|
||||
} else {
|
||||
2
|
||||
});
|
||||
1
|
||||
} else {
|
||||
2
|
||||
});
|
||||
|
||||
fffffffffffffffffffffffffffffffffff(a, {
|
||||
SCRIPT_TASK_ROOT.with(|root| { *root.borrow_mut() = Some(&script_task); });
|
||||
@ -78,7 +78,7 @@ fn main() {
|
||||
a.b.c.d();
|
||||
|
||||
x().y(|| match cond() {
|
||||
true => (),
|
||||
false => (),
|
||||
});
|
||||
true => (),
|
||||
false => (),
|
||||
});
|
||||
}
|
||||
|
@ -45,13 +45,16 @@ fn main() {
|
||||
});
|
||||
|
||||
// #1581
|
||||
bootstrap.checks.register(
|
||||
"PERSISTED_LOCATIONS",
|
||||
move || if locations2.0.inner_mut.lock().poisoned {
|
||||
bootstrap
|
||||
.checks
|
||||
.register("PERSISTED_LOCATIONS", move || if locations2
|
||||
.0
|
||||
.inner_mut
|
||||
.lock()
|
||||
.poisoned {
|
||||
Check::new(State::Error,
|
||||
"Persisted location storage is poisoned due to a write failure")
|
||||
} else {
|
||||
Check::new(State::Healthy, "Persisted location storage is healthy")
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user