ast::ExprKind::Closure(..) => (true, &**body),
_ => (false, &**body),
};
- extend &= context.config.fn_call_style == IndentStyle::Block;
+ extend &= context.config.fn_call_style() == IndentStyle::Block;
let comma = arm_comma(&context.config, body);
let alt_block_sep = String::from("\n") +
if overflow_last {
let last_arg = args.last().unwrap();
let arg_shape = match last_arg.node {
- ast::ExprKind::Closure(..) if context.config.fn_call_style == IndentStyle::Block => {
+ ast::ExprKind::Closure(..) if context.config.fn_call_style() == IndentStyle::Block => {
let mut arg_shape = shape.block();
- arg_shape.indent.block_indent -= context.config.tab_spaces;
+ arg_shape.indent.block_indent -= context.config.tab_spaces();
arg_shape
}
_ => shape.block(),
Ok(())
}
+
+// #1449
+fn future_rayon_wait_1_thread() {
+ // run with only 1 worker thread; this would deadlock if we couldn't make progress
+ let mut result = None;
+ ThreadPool::new(Configuration::new().num_threads(1))
+ .unwrap()
+ .install(
+ || {
+ scope(
+ |s| {
+ use std::sync::mpsc::channel;
+ let (tx, rx) = channel();
+ let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
+ // ^^^^ FIXME: why is this needed?
+ let b = s.spawn_future(a.map(|v| v + 1));
+ let c = s.spawn_future(b.map(|v| v + 1));
+ s.spawn(move |_| tx.send(20).unwrap());
+ result = Some(c.rayon_wait().unwrap());
+ },
+ );
+ },
+ );
+ assert_eq!(result, Some(22));
+}
+
+// #1494
+impl Cursor {
+ fn foo() {
+ self.cur_type()
+ .num_template_args()
+ .or_else(|| {
+ let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
+
+ if n >= 0 {
+ Some(n as u32)
+ } else {
+ debug_assert_eq!(n, -1);
+ None
+ }
+ })
+ .or_else(|| {
+ let canonical = self.canonical();
+ if canonical != *self {
+ canonical.num_template_args()
+ } else {
+ None
+ }
+ });
+ }
+}
DefinitiveListTactic::Horizontal
}
}
+
+fn combine_block() {
+ foo(
+ Bar {
+ x: value,
+ y: value2,
+ },
+ );
+
+ let opt = Some(
+ Struct(
+ long_argument_one,
+ long_argument_two,
+ long_argggggggg,
+ ),
+ );
+
+ do_thing(
+ |param| {
+ action();
+ foo(param)
+ },
+ );
+
+ do_thing(
+ x,
+ |param| {
+ action();
+ foo(param)
+ },
+ );
+
+ Ok(
+ some_function(
+ lllllllllong_argument_one,
+ lllllllllong_argument_two,
+ lllllllllllllllllllllllllllllong_argument_three,
+ ),
+ );
+
+ foo(
+ thing,
+ bar(
+ param2,
+ pparam1param1param1param1param1param1param1param1param1param1aram1,
+ param3,
+ ),
+ );
+
+ foo.map_or(
+ || {
+ Ok(
+ SomeStruct {
+ f1: 0,
+ f2: 0,
+ f3: 0,
+ },
+ )
+ },
+ );
+
+ match opt {
+ Some(x) => somefunc(anotherfunc(
+ long_argument_one,
+ long_argument_two,
+ long_argument_three,
+ )),
+ None => Ok(SomeStruct {
+ f1: long_argument_one,
+ f2: long_argument_two,
+ f3: long_argument_three,
+ }),
+ };
+
+ match x {
+ y => func(
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
+ ),
+ _ => func(
+ x,
+ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
+ zzz,
+ ),
+ }
+}
// rustfmt-fn_call_style: Block
// #1547
-fuzz_target!(
- |data: &[u8]| {
- if let Some(first) = data.first() {
- let index = *first as usize;
- if index >= ENCODINGS.len() {
- return;
- }
- let encoding = ENCODINGS[index];
- dispatch_test(encoding, &data[1..]);
+fuzz_target!(|data: &[u8]| {
+ if let Some(first) = data.first() {
+ let index = *first as usize;
+ if index >= ENCODINGS.len() {
+ return;
}
+ let encoding = ENCODINGS[index];
+ dispatch_test(encoding, &data[1..]);
}
-);
+});
"elit",
);
// #1501
- let hyper = Arc::new(
- Client::with_connector(HttpsConnector::new(TlsClient::new())),
- );
+ let hyper = Arc::new(Client::with_connector(HttpsConnector::new(
+ TlsClient::new(),
+ )));
}
// #1521
impl Foo {
fn map_pixel_to_coords(&self, point: &Vector2i, view: &View) -> Vector2f {
unsafe {
- Vector2f::from_raw(
- ffi::sfRenderTexture_mapPixelToCoords(self.render_texture, point.raw(), view.raw()),
- )
+ Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
+ self.render_texture,
+ point.raw(),
+ view.raw(),
+ ))
}
}
}
Ok(())
}
+
+// #1449
+fn future_rayon_wait_1_thread() {
+ // run with only 1 worker thread; this would deadlock if we couldn't make progress
+ let mut result = None;
+ ThreadPool::new(Configuration::new().num_threads(1))
+ .unwrap()
+ .install(|| {
+ scope(|s| {
+ use std::sync::mpsc::channel;
+ let (tx, rx) = channel();
+ let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
+ // ^^^^ FIXME: why is this needed?
+ let b = s.spawn_future(a.map(|v| v + 1));
+ let c = s.spawn_future(b.map(|v| v + 1));
+ s.spawn(move |_| tx.send(20).unwrap());
+ result = Some(c.rayon_wait().unwrap());
+ });
+ });
+ assert_eq!(result, Some(22));
+}
+
+// #1494
+impl Cursor {
+ fn foo() {
+ self.cur_type()
+ .num_template_args()
+ .or_else(|| {
+ let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
+
+ if n >= 0 {
+ Some(n as u32)
+ } else {
+ debug_assert_eq!(n, -1);
+ None
+ }
+ })
+ .or_else(|| {
+ let canonical = self.canonical();
+ if canonical != *self {
+ canonical.num_template_args()
+ } else {
+ None
+ }
+ });
+ }
+}
DefinitiveListTactic::Horizontal
}
}
+
+fn combine_block() {
+ foo(Bar {
+ x: value,
+ y: value2,
+ });
+
+ let opt = Some(Struct(
+ long_argument_one,
+ long_argument_two,
+ long_argggggggg,
+ ));
+
+ do_thing(|param| {
+ action();
+ foo(param)
+ });
+
+ do_thing(x, |param| {
+ action();
+ foo(param)
+ });
+
+ Ok(some_function(
+ lllllllllong_argument_one,
+ lllllllllong_argument_two,
+ lllllllllllllllllllllllllllllong_argument_three,
+ ));
+
+ foo(
+ thing,
+ bar(
+ param2,
+ pparam1param1param1param1param1param1param1param1param1param1aram1,
+ param3,
+ ),
+ );
+
+ foo.map_or(|| {
+ Ok(SomeStruct {
+ f1: 0,
+ f2: 0,
+ f3: 0,
+ })
+ });
+
+ match opt {
+ Some(x) => somefunc(anotherfunc(
+ long_argument_one,
+ long_argument_two,
+ long_argument_three,
+ )),
+ None => Ok(SomeStruct {
+ f1: long_argument_one,
+ f2: long_argument_two,
+ f3: long_argument_three,
+ }),
+ };
+
+ match x {
+ y => func(
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
+ ),
+ _ => {
+ func(
+ x,
+ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
+ zzz,
+ )
+ }
+ }
+}