]> git.lizzy.rs Git - rust.git/blob - tests/target/fn.rs
Merge pull request #966 from MicahChalmer/skip-children-in-plain-write-mode
[rust.git] / tests / target / fn.rs
1 // Tests different fns
2
3 fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {}
4
5 fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType where T: Blah {}
6
7 fn foo(a: AAA /* (comment) */) where T: Blah {}
8
9 fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
10        b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
11        -> RetType
12     where T: Blah
13 {
14
15 }
16
17
18 fn foo<U, T>(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
19              b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
20              -> RetType
21     where T: Blah,
22           U: dsfasdfasdfasd
23 {
24
25 }
26
27 fn foo<U: Fn(A) -> B /* paren inside generics */>() {}
28
29 impl Foo {
30     fn with_no_errors<T, F>(&mut self, f: F) -> T where F: FnOnce(&mut Resolver) -> T {}
31
32     fn foo(mut self, mut bar: u32) {}
33
34     fn bar(self, mut bazz: u32) {}
35 }
36
37 pub fn render<'a,
38               N: Clone + 'a,
39               E: Clone + 'a,
40               G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
41               W: Write>
42     (g: &'a G,
43      w: &mut W)
44      -> io::Result<()> {
45     render_opts(g, w, &[])
46 }
47
48 const fn foo() {
49     x;
50 }
51
52 pub const fn foo() {
53     x;
54 }
55
56 impl Foo {
57     const fn foo() {
58         x;
59     }
60 }
61
62 fn homura<T: Deref<Target = i32>>(_: T) {}
63
64 fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}
65
66 fn main() {
67     let _ = function(move || 5);
68     let _ = move || 42;
69     let _ = || unsafe { abort() };
70 }
71
72 // With inner attributes.
73 fn inner() {
74     #![inline]
75     x
76 }
77
78 #[cfg_attr(rustfmt, rustfmt_skip)]
79 fn foo(a: i32) -> i32 {
80     // comment
81     if a > 0 { 1 } else { 2 }
82 }
83
84 fn ______________________baz(a: i32)
85     ->
86         *mut ::std::option::Option<extern "C" fn(arg1: i32,
87                                                 _____________________a: i32,
88                                                 arg3: i32)
89                                     -> ()> {
90 }