summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/fn.rs
blob: 0ad775ee1ddf781028b5914dd9bdc91c5f994443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// 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 homura<T: Deref<Target = i32>>(_: T) {}

fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}

fn main() {
    let _ = function(move || 5);
    let _ = move || 42;
    let _ = || unsafe { abort() };
}

// With inner attributes.
fn inner() {
    #![inline]
    x
}

#[cfg_attr(rustfmt, rustfmt::skip)]
fn foo(a: i32) -> i32 {
    // comment
    if a > 0 { 1 } else { 2 }
}

fn ______________________baz(
    a: i32,
) -> *mut ::std::option::Option<
    extern "C" fn(arg1: i32, _____________________a: i32, arg3: i32) -> (),
> {
}

pub fn check_path<'a, 'tcx>(
    tcx: TyCtxt<'a, 'tcx, 'tcx>,
    path: &hir::Path,
    id: ast::NodeId,
    cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Depecation>),
) {
}

pub fn check_path<'a, 'tcx>(
    tcx: TyCtxt<'a, 'tcx, 'tcx>,
    path: &hir::Path,
    id: ast::NodeId,
    cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>),
) {
}