summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/fn-simple.rs
blob: e725269360d2cf23b8c4fd6b162e72bf74be7c47 (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
// rustfmt-normalize_comments: true

fn simple(
    // pre-comment on a function!?
    i: i32,          // yes, it's possible!
    response: NoWay, // hose
) {
    fn op(
        x: Typ,
        key: &[u8],
        upd: Box<
            Fn(
                Option<&memcache::Item>,
            ) -> (memcache::Status, Result<memcache::Item, Option<String>>),
        >,
    ) -> MapResult {
    }

    "cool"
}

fn weird_comment(
    // /*/ double level */ comment
    x: Hello, // /*/* triple, even */*/
    // Does this work?
    y: World,
) {
    simple(/* does this preserve comments now? */ 42, NoWay)
}

fn generic<T>(arg: T) -> &SomeType
where
    T: Fn(
        // First arg
        A,
        // Second argument
        B,
        C,
        D,
        // pre comment
        E, // last comment
    ) -> &SomeType,
{
    arg(a, b, c, d, e)
}

fn foo() -> ! {}

pub fn http_fetch_async(
    listener: Box<AsyncCORSResponseListener + Send>,
    script_chan: Box<ScriptChan + Send>,
) {
}

fn some_func<T: Box<Trait + Bound>>(val: T) {}

fn zzzzzzzzzzzzzzzzzzzz<Type, NodeType>(
    selff: Type,
    mut handle: node::Handle<IdRef<'id, Node<K, V>>, Type, NodeType>,
) -> SearchStack<'a, K, V, Type, NodeType> {
}

unsafe fn generic_call(
    cx: *mut JSContext,
    argc: libc::c_uint,
    vp: *mut JSVal,
    is_lenient: bool,
    call: unsafe extern "C" fn(
        *const JSJitInfo,
        *mut JSContext,
        HandleObject,
        *mut libc::c_void,
        u32,
        *mut JSVal,
    ) -> u8,
) {
    let f: fn(_, _) -> _ = panic!();
}

pub fn start_export_thread<C: CryptoSchemee + 'static>(
    database: &Database,
    crypto_scheme: &C,
    block_size: usize,
    source_path: &Path,
) -> BonzoResult<mpsc::Consumer<'static, FileInstruction>> {
}

pub fn waltz(cwd: &Path) -> CliAssert {
    {
        {
            formatted_comment =
                rewrite_comment(comment, block_style, width, offset, formatting_fig);
        }
    }
}

// #2003
mod foo {
    fn __bindgen_test_layout_i_open0_c_open1_char_a_open2_char_close2_close1_close0_instantiation()
    {
        foo();
    }
}

// #2082
pub(crate) fn init() {}

pub(crate) fn init() {}

// #2630
fn make_map<T, F: (Fn(&T) -> String)>(records: &Vec<T>, key_fn: F) -> HashMap<String, usize> {}

// #2956
fn bar(
    beans: Asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf,
    spam: bool,
    eggs: bool,
) -> bool {
    unimplemented!();
}