|
1 | 1 | // To activate a doctest locally, remove ",ignore" from the code block. |
2 | 2 |
|
3 | 3 | /// ```compile_fail,ignore |
4 | | -/// use macros::hashmap; |
5 | | -/// use std::collections::HashMap; |
| 4 | +/// # use macros::hashmap; |
| 5 | +/// # use std::collections::HashMap; |
6 | 6 | /// |
7 | 7 | /// // using only commas is invalid |
8 | 8 | /// let _hm: HashMap<_, _> = hashmap!('a', 1); |
9 | 9 | /// ``` |
10 | 10 | const _COMMA_SEPARATOR: () = (); |
11 | 11 |
|
12 | 12 | /// ```compile_fail,ignore |
13 | | -/// use macros::hashmap; |
14 | | -/// use std::collections::HashMap; |
| 13 | +/// # use macros::hashmap; |
| 14 | +/// # use std::collections::HashMap; |
15 | 15 | /// |
16 | 16 | /// // a single trailing comma is okay, but two is not |
17 | 17 | /// let _hm: HashMap<_, _> = hashmap!('a' => 2, ,); |
18 | 18 | /// ``` |
19 | 19 | const _DOUBLE_TRAILING_COMMAS: () = (); |
20 | 20 |
|
21 | 21 | /// ```compile_fail,ignore |
22 | | -/// use macros::hashmap; |
23 | | -/// use std::collections::HashMap; |
| 22 | +/// # use macros::hashmap; |
| 23 | +/// # use std::collections::HashMap; |
24 | 24 | /// |
25 | 25 | /// // a single random comma is not valid |
26 | 26 | /// let _hm: HashMap<(), ()> = hashmap!(,); |
27 | 27 | /// ``` |
28 | 28 | const _ONLY_COMMA: () = (); |
29 | 29 |
|
30 | 30 | /// ```compile_fail,ignore |
31 | | -/// use macros::hashmap; |
32 | | -/// use std::collections::HashMap; |
| 31 | +/// # use macros::hashmap; |
| 32 | +/// # use std::collections::HashMap; |
33 | 33 | /// |
34 | 34 | /// // a single argument is invalid |
35 | 35 | /// let _hm: HashMap<_, _> = hashmap!('a'); |
36 | 36 | /// ``` |
37 | 37 | const _SINGLE_ARGUMENT: () = (); |
38 | 38 |
|
39 | 39 | /// ```compile_fail,ignore |
40 | | -/// use macros::hashmap; |
41 | | -/// use std::collections::HashMap; |
| 40 | +/// # use macros::hashmap; |
| 41 | +/// # use std::collections::HashMap; |
42 | 42 | /// |
43 | 43 | /// // three arguments are invalid |
44 | 44 | /// hashmap!('a' => 1, 'b'); |
45 | 45 | /// ``` |
46 | 46 | const _TRIPLE_ARGUMENTS: () = (); |
47 | 47 |
|
48 | 48 | /// ```compile_fail,ignore |
49 | | -/// use macros::hashmap; |
50 | | -/// use std::collections::HashMap; |
| 49 | +/// # use macros::hashmap; |
| 50 | +/// # use std::collections::HashMap; |
51 | 51 | /// |
52 | 52 | /// // a single random arrow is not valid |
53 | 53 | /// let _hm: HashMap<(), ()> = hashmap!(=>); |
54 | 54 | /// ``` |
55 | 55 | const _ONLY_ARROW: () = (); |
56 | 56 |
|
57 | 57 | /// ```compile_fail,ignore |
58 | | -/// use macros::hashmap; |
59 | | -/// use std::collections::HashMap; |
| 58 | +/// # use macros::hashmap; |
| 59 | +/// # use std::collections::HashMap; |
60 | 60 | /// |
61 | 61 | /// // a trailing => isn't valid either |
62 | 62 | /// hashmap!('a' => 2, =>); |
63 | 63 | /// ``` |
64 | 64 | const _TRAILING_ARROW: () = (); |
65 | 65 |
|
66 | 66 | /// ```compile_fail,ignore |
67 | | -/// use macros::hashmap; |
68 | | -/// use std::collections::HashMap; |
| 67 | +/// # use macros::hashmap; |
| 68 | +/// # use std::collections::HashMap; |
69 | 69 | /// |
70 | 70 | /// // leading commas are not valid |
71 | 71 | /// let _hm: HashMap<_, _> = hashmap!(, 'a' => 2); |
72 | 72 | /// ``` |
73 | 73 | const _LEADING_COMMA: () = (); |
74 | 74 |
|
75 | 75 | /// ```compile_fail,ignore |
76 | | -/// use macros::hashmap; |
77 | | -/// use std::collections::HashMap; |
| 76 | +/// # use macros::hashmap; |
| 77 | +/// # use std::collections::HashMap; |
78 | 78 | /// |
79 | 79 | /// // Key value pairs must be separated by commas |
80 | 80 | /// let _hm: HashMap<_, _> = hashmap!('a' => 1 'b' => 2); |
81 | 81 | /// ``` |
82 | 82 | const _MISSING_COMMA: () = (); |
83 | 83 |
|
84 | 84 | /// ```compile_fail,ignore |
85 | | -/// use macros::hashmap; |
86 | | -/// use std::collections::HashMap; |
| 85 | +/// # use macros::hashmap; |
| 86 | +/// # use std::collections::HashMap; |
87 | 87 | /// |
88 | 88 | /// // an argument should come between each pair of commas |
89 | 89 | /// let _hm: HashMap<_, _> = hashmap!('a' => 1, , 'b' => 2); |
|
0 commit comments