@@ -187,8 +187,10 @@ them yourself.
187
187
You can build a free-standing crate by adding `#![no_std]` to the crate
188
188
attributes:
189
189
190
+ ```
190
191
#![feature(no_std)]
191
192
#![no_std]
193
+ ```
192
194
193
195
See also https://doc.rust-lang.org/book/no-stdlib.html
194
196
"## ,
@@ -204,11 +206,13 @@ mutex can be declared `static` as well.
204
206
205
207
If you want to match against a `static`, consider using a guard instead:
206
208
209
+ ```
207
210
static FORTY_TWO: i32 = 42;
208
211
match Some(42) {
209
212
Some(x) if x == FORTY_TWO => ...
210
213
...
211
214
}
215
+ ```
212
216
"## ,
213
217
214
218
E0161 : r##"
@@ -265,17 +269,21 @@ loop {
265
269
E0170 : r##"
266
270
Enum variants are qualified by default. For example, given this type:
267
271
272
+ ```
268
273
enum Method {
269
274
GET,
270
275
POST
271
276
}
277
+ ```
272
278
273
279
you would match it using:
274
280
281
+ ```
275
282
match m {
276
283
Method::GET => ...
277
284
Method::POST => ...
278
285
}
286
+ ```
279
287
280
288
If you don't qualify the names, the code will bind new variables named "GET" and
281
289
"POST" instead. This behavior is likely not what you want, so rustc warns when
@@ -284,8 +292,10 @@ that happens.
284
292
Qualified names are good practice, and most code works well with them. But if
285
293
you prefer them unqualified, you can import the variants into scope:
286
294
295
+ ```
287
296
use Method::*;
288
297
enum Method { GET, POST }
298
+ ```
289
299
"## ,
290
300
291
301
E0267 : r##"
@@ -305,7 +315,9 @@ E0296: r##"
305
315
This error indicates that the given recursion limit could not be parsed. Ensure
306
316
that the value provided is a positive integer between quotes, like so:
307
317
318
+ ```
308
319
#![recursion_limit="1000"]
320
+ ```
309
321
"## ,
310
322
311
323
E0297 : r##"
0 commit comments