]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/fn-simple.rs
Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26
[rust.git] / src / tools / rustfmt / tests / target / fn-simple.rs
1 // rustfmt-normalize_comments: true
2
3 fn simple(
4     // pre-comment on a function!?
5     i: i32,          // yes, it's possible!
6     response: NoWay, // hose
7 ) {
8     fn op(
9         x: Typ,
10         key: &[u8],
11         upd: Box<
12             Fn(
13                 Option<&memcache::Item>,
14             ) -> (memcache::Status, Result<memcache::Item, Option<String>>),
15         >,
16     ) -> MapResult {
17     }
18
19     "cool"
20 }
21
22 fn weird_comment(
23     // /*/ double level */ comment
24     x: Hello, // /*/* triple, even */*/
25     // Does this work?
26     y: World,
27 ) {
28     simple(/* does this preserve comments now? */ 42, NoWay)
29 }
30
31 fn generic<T>(arg: T) -> &SomeType
32 where
33     T: Fn(
34         // First arg
35         A,
36         // Second argument
37         B,
38         C,
39         D,
40         // pre comment
41         E, // last comment
42     ) -> &SomeType,
43 {
44     arg(a, b, c, d, e)
45 }
46
47 fn foo() -> ! {}
48
49 pub fn http_fetch_async(
50     listener: Box<AsyncCORSResponseListener + Send>,
51     script_chan: Box<ScriptChan + Send>,
52 ) {
53 }
54
55 fn some_func<T: Box<Trait + Bound>>(val: T) {}
56
57 fn zzzzzzzzzzzzzzzzzzzz<Type, NodeType>(
58     selff: Type,
59     mut handle: node::Handle<IdRef<'id, Node<K, V>>, Type, NodeType>,
60 ) -> SearchStack<'a, K, V, Type, NodeType> {
61 }
62
63 unsafe fn generic_call(
64     cx: *mut JSContext,
65     argc: libc::c_uint,
66     vp: *mut JSVal,
67     is_lenient: bool,
68     call: unsafe extern "C" fn(
69         *const JSJitInfo,
70         *mut JSContext,
71         HandleObject,
72         *mut libc::c_void,
73         u32,
74         *mut JSVal,
75     ) -> u8,
76 ) {
77     let f: fn(_, _) -> _ = panic!();
78 }
79
80 pub fn start_export_thread<C: CryptoSchemee + 'static>(
81     database: &Database,
82     crypto_scheme: &C,
83     block_size: usize,
84     source_path: &Path,
85 ) -> BonzoResult<mpsc::Consumer<'static, FileInstruction>> {
86 }
87
88 pub fn waltz(cwd: &Path) -> CliAssert {
89     {
90         {
91             formatted_comment =
92                 rewrite_comment(comment, block_style, width, offset, formatting_fig);
93         }
94     }
95 }
96
97 // #2003
98 mod foo {
99     fn __bindgen_test_layout_i_open0_c_open1_char_a_open2_char_close2_close1_close0_instantiation()
100     {
101         foo();
102     }
103 }
104
105 // #2082
106 pub(crate) fn init() {}
107
108 crate fn init() {}
109
110 // #2630
111 fn make_map<T, F: (Fn(&T) -> String)>(records: &Vec<T>, key_fn: F) -> HashMap<String, usize> {}
112
113 // #2956
114 fn bar(
115     beans: Asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf,
116     spam: bool,
117     eggs: bool,
118 ) -> bool {
119     unimplemented!();
120 }