]> git.lizzy.rs Git - rust.git/blob - tests/target/fn.rs
Tidy up and pass tests
[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
6 where
7     T: Blah,
8 {
9 }
10
11 fn foo(a: AAA /* (comment) */)
12 where
13     T: Blah,
14 {
15 }
16
17 fn foo(
18     a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
19     b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
20 ) -> RetType
21 where
22     T: Blah,
23 {
24
25 }
26
27 fn foo<U, T>(
28     a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
29     b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
30 ) -> RetType
31 where
32     T: Blah,
33     U: dsfasdfasdfasd,
34 {
35
36 }
37
38 fn foo<U: Fn(A) -> B /* paren inside generics */>() {}
39
40 impl Foo {
41     fn with_no_errors<T, F>(&mut self, f: F) -> T
42     where
43         F: FnOnce(&mut Resolver) -> T,
44     {
45     }
46
47     fn foo(mut self, mut bar: u32) {}
48
49     fn bar(self, mut bazz: u32) {}
50 }
51
52 pub fn render<
53     'a,
54     N: Clone + 'a,
55     E: Clone + 'a,
56     G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
57     W: Write,
58 >(
59     g: &'a G,
60     w: &mut W,
61 ) -> io::Result<()> {
62     render_opts(g, w, &[])
63 }
64
65 const fn foo() {
66     x;
67 }
68
69 pub const fn foo() {
70     x;
71 }
72
73 impl Foo {
74     const fn foo() {
75         x;
76     }
77 }
78
79 fn homura<T: Deref<Target = i32>>(_: T) {}
80
81 fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}
82
83 fn main() {
84     let _ = function(move || 5);
85     let _ = move || 42;
86     let _ = || unsafe { abort() };
87 }
88
89 // With inner attributes.
90 fn inner() {
91     #![inline]
92     x
93 }
94
95 #[cfg_attr(rustfmt, rustfmt_skip)]
96 fn foo(a: i32) -> i32 {
97     // comment
98     if a > 0 { 1 } else { 2 }
99 }
100
101 fn ______________________baz(
102     a: i32,
103 ) -> *mut ::std::option::Option<
104     extern "C" fn(arg1: i32, _____________________a: i32, arg3: i32) -> (),
105 > {
106 }
107
108 pub fn check_path<'a, 'tcx>(
109     tcx: TyCtxt<'a, 'tcx, 'tcx>,
110     path: &hir::Path,
111     id: ast::NodeId,
112     cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Depecation>),
113 ) {
114 }
115
116 pub fn check_path<'a, 'tcx>(
117     tcx: TyCtxt<'a, 'tcx, 'tcx>,
118     path: &hir::Path,
119     id: ast::NodeId,
120     cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>),
121 ) {
122 }