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