rust/tests/target/fn.rs
Marcus Klaas d13fc2289a Fix underflow bug in rewrite_call
Fixes https://github.com/nrc/rustfmt/issues/148.
Now properly propagates the rewrite failure instead of panicking. Added regression test from servo code. This example will be properly rewritten when https://github.com/nrc/rustfmt/issues/17 is addressed.
2015-07-22 23:43:24 +02:00

95 lines
1.6 KiB
Rust

// Tests different fns
fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {
}
fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType
where T: Blah
{
}
fn foo(a: AAA /* (comment) */)
where T: Blah
{
}
fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
-> RetType
where T: Blah
{
}
fn foo<U, T>(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
-> RetType
where T: Blah,
U: dsfasdfasdfasd
{
}
fn foo<U: Fn(A) -> B /* paren inside generics */>() {
}
impl Foo {
fn with_no_errors<T, F>(&mut self, f: F) -> T
where F: FnOnce(&mut Resolver) -> T
{
}
fn foo(mut self, mut bar: u32) {
}
fn bar(self, mut bazz: u32) {
}
}
pub fn render<'a,
N: Clone + 'a,
E: Clone + 'a,
G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
W: Write>
(g: &'a G,
w: &mut W)
-> io::Result<()> {
render_opts(g, w, &[])
}
const fn foo() {
x;
}
pub const fn foo() {
x;
}
impl Foo {
const fn foo() {
x;
}
}
fn main() {
let _ = function(move || 5);
let _ = move || 42;
}
fn servo() {
let constellation_chan = Constellation::<layout::layout_task::LayoutTask,
script::script_task::ScriptTask>::start(
compositor_proxy,
resource_task,
image_cache_task,
font_cache_task,
time_profiler_chan,
mem_profiler_chan,
devtools_chan,
storage_task,
supports_clipboard);
}