]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/fn-simple.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / fn-simple.rs
CommitLineData
f20569fa
XL
1// rustfmt-normalize_comments: true
2
3fn 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
22fn 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
31fn generic<T>(arg: T) -> &SomeType
32where
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
47fn foo() -> ! {}
48
49pub fn http_fetch_async(
50 listener: Box<AsyncCORSResponseListener + Send>,
51 script_chan: Box<ScriptChan + Send>,
52) {
53}
54
55fn some_func<T: Box<Trait + Bound>>(val: T) {}
56
57fn 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
63unsafe 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
80pub 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
88pub 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
98mod 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
106pub(crate) fn init() {}
107
923072b8 108pub(crate) fn init() {}
f20569fa
XL
109
110// #2630
111fn make_map<T, F: (Fn(&T) -> String)>(records: &Vec<T>, key_fn: F) -> HashMap<String, usize> {}
112
113// #2956
114fn bar(
115 beans: Asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf,
116 spam: bool,
117 eggs: bool,
118) -> bool {
119 unimplemented!();
120}