rust/tests/target/configs-fn_call_style-block.rs

123 lines
2.9 KiB
Rust
Raw Normal View History

// rustfmt-fn_call_style: Block
// Function call style
fn main() {
lorem(
"lorem",
"ipsum",
"dolor",
"sit",
"amet",
"consectetur",
"adipiscing",
"elit",
);
2017-05-04 01:17:57 -05:00
// #1501
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 {
2017-05-21 05:56:37 -05:00
Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
self.render_texture,
point.raw(),
view.raw(),
))
}
}
}
2017-05-19 05:28:00 -05:00
fn issue1420() {
given(
r#"
# Getting started
...
"#,
2017-05-23 08:13:29 -05:00
).running(waltz)
2017-05-19 05:28:00 -05:00
}
// #1563
fn query(conn: &Connection) -> Result<()> {
conn.query_row(
r#"
SELECT title, date
FROM posts,
WHERE DATE(date) = $1
"#,
&[],
|row| {
Post {
title: row.get(0),
date: row.get(1),
}
},
)?;
Ok(())
}
2017-05-21 05:56:37 -05:00
// #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
}
});
}
}
fn issue1581() {
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")
},
);
}