You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code example showcasing the unintended or consequential behavior. Non-normative.
159
+
160
+
**Hidden lines:** If your code needs `use` statements, a `fn main()` wrapper, or other boilerplate to compile, but you don't want them shown in the documentation, prefix those lines with `# ` (hash + space). These lines will be compiled but hidden in the rendered docs.
161
+
162
+
Example with hidden lines:
163
+
```
164
+
# use std::mem::MaybeUninit;
165
+
# fn main() {
166
+
let x: u32 = unsafe { MaybeUninit::uninit().assume_init() }; // UB
167
+
# }
168
+
```
169
+
placeholder: |
170
+
# use std::collections::HashMap;
171
+
# fn main() {
172
+
let map = HashMap::new();
173
+
# }
159
174
validations:
160
175
required: true
161
176
- type: textarea
@@ -170,7 +185,22 @@ body:
170
185
id: compliant-example-code
171
186
attributes:
172
187
label: Compliant Example - Code
173
-
description: Here we write a code example showcasing we avoid unintended or consequential behavior by following the Coding Guideline.
174
-
placeholder: fn compliant_example() { /* ... */ }
188
+
description: |
189
+
Code example showcasing we avoid unintended or consequential behavior by following the Coding Guideline.
190
+
191
+
**Hidden lines:** If your code needs `use` statements, a `fn main()` wrapper, or other boilerplate to compile, but you don't want them shown in the documentation, prefix those lines with `# ` (hash + space). These lines will be compiled but hidden in the rendered docs.
0 commit comments