1 // rustfmt-indent_style: Visual
2 // Test chain formatting.
5 // Don't put chains on a single line if it wasn't so in source.
6 let a = b.c.d.1.foo(|x| x + 1);
8 bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
9 .ddddddddddddddddddddddddddd();
11 bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
12 .ddddddddddddddddddddddddddd
15 // Test case where first chain element isn't a path, but is shorter than
17 x().y(|| match cond() {
22 loong_func().quux(move || if true { 1 } else { 2 });
24 some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| {
29 some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| {
33 .method_call_b(aaaaa, bbbbb, |c| {
38 fffffffffffffffffffffffffffffffffff(a, {
39 SCRIPT_TASK_ROOT.with(|root| {
40 *root.borrow_mut() = Some(&script_task);
44 let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum =
45 xxxxxxx.map(|x| x + 5)
47 .fold(0, |acc, x| acc + x);
49 aaaaaaaaaaaaaaaa.map(|x| {
53 .filter(some_mod::some_filter)
57 let z = Foo { field1: val1,
60 let x = Foo { field1: val1,
61 field2: val2 }.method_call()
64 let y = if cond { val1 } else { val2 }.method_call();
69 // params are 1-indexed
70 stack.push(mparams[match cur.to_digit(10) {
71 Some(d) => d as usize - 1,
72 None => return Err("bad param number".to_owned()),
85 Foo { x: val }.baz(|| {
91 Foo { y: i_am_multi_line,
104 fn is_replaced_content() -> bool {
105 constellat.send(ConstellationMsg::ViewportConstrained(self.id, constraints))
112 std::mem::transmute(dl.symbol::<()>("init").unwrap())
116 let names = String::from_utf8(names)?.split('|')
121 fn issue1217() -> Result<Mnemonic, Error> {
122 let random_chars: String = OsRng::new()?.gen_ascii_chars()
123 .take(self.bit_length)
126 Ok(Mnemonic::new(&random_chars))
129 fn issue1236(options: Vec<String>) -> Result<Option<String>> {
130 let process = Command::new("dmenu").stdin(Stdio::piped())
131 .stdout(Stdio::piped())
133 .chain_err(|| "failed to spawn dmenu")?;
139 PrototypeIdData::from_reader::<_, B>(&mut self.file_cursor).chain_err(|| {
140 format!("could not read prototype ID at offset {:#010x}",
150 if let a_very_very_very_very_very_very_very_very_long_variable =
151 compute_this_variable()