2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2017-11-13 01:25:50 -06:00
|
|
|
// rustfmt-indent_style: Visual
|
2016-04-27 15:08:54 -05:00
|
|
|
// Test chain formatting.
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Don't put chains on a single line if it wasn't so in source.
|
2017-03-27 17:25:59 -05:00
|
|
|
let a = b.c.d.1.foo(|x| x + 1);
|
2016-04-27 15:08:54 -05:00
|
|
|
|
2017-03-27 17:25:59 -05:00
|
|
|
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
|
|
|
|
.ddddddddddddddddddddddddddd();
|
2016-04-27 15:08:54 -05:00
|
|
|
|
|
|
|
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
|
|
|
|
.ddddddddddddddddddddddddddd
|
|
|
|
.eeeeeeee();
|
|
|
|
|
|
|
|
// Test case where first chain element isn't a path, but is shorter than
|
|
|
|
// the size of a tab.
|
|
|
|
x().y(|| match cond() {
|
2017-11-13 01:42:04 -06:00
|
|
|
true => (),
|
|
|
|
false => (),
|
|
|
|
});
|
2016-04-27 15:08:54 -05:00
|
|
|
|
2017-11-24 01:17:06 -06:00
|
|
|
loong_func().quux(move || if true { 1 } else { 2 });
|
2016-04-27 15:08:54 -05:00
|
|
|
|
|
|
|
some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| {
|
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
});
|
|
|
|
|
2017-08-07 01:17:57 -05:00
|
|
|
some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| {
|
2017-11-29 02:37:56 -06:00
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
})
|
2017-08-07 01:17:57 -05:00
|
|
|
.method_call_b(aaaaa, bbbbb, |c| {
|
2017-11-29 02:37:56 -06:00
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
});
|
2016-04-27 15:08:54 -05:00
|
|
|
|
|
|
|
fffffffffffffffffffffffffffffffffff(a, {
|
2017-09-02 18:10:12 -05:00
|
|
|
SCRIPT_TASK_ROOT.with(|root| {
|
2017-11-13 02:37:56 -06:00
|
|
|
*root.borrow_mut() = Some(&script_task);
|
|
|
|
});
|
2016-04-27 15:08:54 -05:00
|
|
|
});
|
|
|
|
|
2017-11-29 02:37:56 -06:00
|
|
|
let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum =
|
|
|
|
xxxxxxx.map(|x| x + 5)
|
|
|
|
.map(|x| x / 2)
|
|
|
|
.fold(0, |acc, x| acc + x);
|
2016-04-27 15:08:54 -05:00
|
|
|
|
|
|
|
aaaaaaaaaaaaaaaa.map(|x| {
|
2017-11-13 02:37:56 -06:00
|
|
|
x += 1;
|
|
|
|
x
|
|
|
|
})
|
2016-04-27 15:08:54 -05:00
|
|
|
.filter(some_mod::some_filter)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn floaters() {
|
2017-11-13 01:42:04 -06:00
|
|
|
let z = Foo { field1: val1,
|
|
|
|
field2: val2, };
|
|
|
|
|
|
|
|
let x = Foo { field1: val1,
|
|
|
|
field2: val2, }.method_call()
|
2016-04-27 15:08:54 -05:00
|
|
|
.method_call();
|
|
|
|
|
2017-11-24 01:17:06 -06:00
|
|
|
let y = if cond { val1 } else { val2 }.method_call();
|
2016-04-27 15:08:54 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
match x {
|
|
|
|
PushParam => {
|
|
|
|
// params are 1-indexed
|
2017-11-13 01:42:04 -06:00
|
|
|
stack.push(mparams[match cur.to_digit(10) {
|
|
|
|
Some(d) => d as usize - 1,
|
|
|
|
None => return Err("bad param number".to_owned()),
|
|
|
|
}].clone());
|
2016-04-27 15:08:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if cond {
|
|
|
|
some();
|
|
|
|
} else {
|
|
|
|
none();
|
2017-08-07 01:17:57 -05:00
|
|
|
}.bar()
|
2016-04-27 15:08:54 -05:00
|
|
|
.baz();
|
|
|
|
|
2017-08-07 01:17:57 -05:00
|
|
|
Foo { x: val }.baz(|| {
|
2017-11-13 02:37:56 -06:00
|
|
|
force();
|
|
|
|
multiline();
|
|
|
|
})
|
2017-08-07 01:17:57 -05:00
|
|
|
.quux();
|
2016-04-27 15:08:54 -05:00
|
|
|
|
2017-11-13 01:42:04 -06:00
|
|
|
Foo { y: i_am_multi_line,
|
|
|
|
z: ok, }.baz(|| {
|
2017-11-13 02:37:56 -06:00
|
|
|
force();
|
|
|
|
multiline();
|
|
|
|
})
|
2016-04-27 15:08:54 -05:00
|
|
|
.quux();
|
|
|
|
|
2017-07-21 03:55:52 -05:00
|
|
|
a + match x {
|
2017-07-26 03:43:17 -05:00
|
|
|
true => "yay!",
|
|
|
|
false => "boo!",
|
2017-08-07 01:17:57 -05:00
|
|
|
}.bar()
|
2016-04-27 15:08:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn is_replaced_content() -> bool {
|
2017-03-27 17:25:59 -05:00
|
|
|
constellat.send(ConstellationMsg::ViewportConstrained(self.id, constraints))
|
|
|
|
.unwrap();
|
2016-04-27 15:08:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn issue587() {
|
|
|
|
a.b::<()>(c);
|
|
|
|
|
|
|
|
std::mem::transmute(dl.symbol::<()>("init").unwrap())
|
|
|
|
}
|
2017-04-04 16:28:47 -05:00
|
|
|
|
|
|
|
fn issue_1389() {
|
2017-08-07 01:17:57 -05:00
|
|
|
let names = String::from_utf8(names)?.split('|')
|
|
|
|
.map(str::to_owned)
|
|
|
|
.collect();
|
2017-04-04 16:28:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn issue1217() -> Result<Mnemonic, Error> {
|
2017-08-07 01:17:57 -05:00
|
|
|
let random_chars: String = OsRng::new()?.gen_ascii_chars()
|
|
|
|
.take(self.bit_length)
|
|
|
|
.collect();
|
2017-04-04 16:28:47 -05:00
|
|
|
|
|
|
|
Ok(Mnemonic::new(&random_chars))
|
|
|
|
}
|
|
|
|
|
|
|
|
fn issue1236(options: Vec<String>) -> Result<Option<String>> {
|
2017-08-07 01:17:57 -05:00
|
|
|
let process = Command::new("dmenu").stdin(Stdio::piped())
|
|
|
|
.stdout(Stdio::piped())
|
|
|
|
.spawn()
|
|
|
|
.chain_err(|| "failed to spawn dmenu")?;
|
2017-04-04 16:28:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn issue1434() {
|
|
|
|
for _ in 0..100 {
|
2017-08-07 01:17:57 -05:00
|
|
|
let prototype_id =
|
|
|
|
PrototypeIdData::from_reader::<_, B>(&mut self.file_cursor).chain_err(|| {
|
2017-11-13 01:42:04 -06:00
|
|
|
format!("could not read prototype ID at offset {:#010x}",
|
|
|
|
current_offset)
|
2017-06-11 23:01:41 -05:00
|
|
|
})?;
|
2017-04-04 16:28:47 -05:00
|
|
|
}
|
|
|
|
}
|