Skip to content

Commit f3adea5

Browse files
committed
TRPL: Normalize rust Code Block Markers
`{rust,ignore}` -> `rust,ignore
1 parent 6f69cd6 commit f3adea5

7 files changed

+35
-35
lines changed

src/doc/trpl/benchmark-tests.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Rust supports benchmark tests, which can test the performance of your
44
code. Let's make our `src/lib.rs` look like this (comments elided):
55

6-
```{rust,ignore}
6+
```rust,ignore
77
#![feature(test)]
88
99
extern crate test;
@@ -77,7 +77,7 @@ the benchmark is no longer benchmarking what one expects. For example, the
7777
compiler might recognize that some calculation has no external effects and
7878
remove it entirely.
7979

80-
```{rust,ignore}
80+
```rust,ignore
8181
#![feature(test)]
8282
8383
extern crate test;

src/doc/trpl/box-syntax-and-patterns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ because the syntax may still change in the future.
3434
In many languages with pointers, you'd return a pointer from a function
3535
so as to avoid copying a large data structure. For example:
3636

37-
```{rust}
37+
```rust
3838
struct BigStruct {
3939
one: i32,
4040
two: i32,

src/doc/trpl/crates-and-modules.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ ways.
126126

127127
Instead of declaring a module like this:
128128

129-
```{rust,ignore}
129+
```rust,ignore
130130
mod english {
131131
// contents of our module go here
132132
}
133133
```
134134

135135
We can instead declare our module like this:
136136

137-
```{rust,ignore}
137+
```rust,ignore
138138
mod english;
139139
```
140140

@@ -173,7 +173,7 @@ $ tree .
173173

174174
`src/lib.rs` is our crate root, and looks like this:
175175

176-
```{rust,ignore}
176+
```rust,ignore
177177
mod english;
178178
mod japanese;
179179
```
@@ -184,7 +184,7 @@ on our preference. In this case, because our modules have sub-modules, we’ve
184184
chosen the second. Both `src/english/mod.rs` and `src/japanese/mod.rs` look
185185
like this:
186186

187-
```{rust,ignore}
187+
```rust,ignore
188188
mod greetings;
189189
mod farewells;
190190
```
@@ -297,7 +297,7 @@ public, and so private is the default. To make things public, you use the `pub`
297297
keyword. Let’s focus on the `english` module first, so let’s reduce our `src/main.rs`
298298
to just this:
299299
300-
```{rust,ignore}
300+
```rust,ignore
301301
extern crate phrases;
302302

303303
fn main() {
@@ -308,29 +308,29 @@ fn main() {
308308
309309
In our `src/lib.rs`, let’s add `pub` to the `english` module declaration:
310310
311-
```{rust,ignore}
311+
```rust,ignore
312312
pub mod english;
313313
mod japanese;
314314
```
315315
316316
And in our `src/english/mod.rs`, let’s make both `pub`:
317317
318-
```{rust,ignore}
318+
```rust,ignore
319319
pub mod greetings;
320320
pub mod farewells;
321321
```
322322
323323
In our `src/english/greetings.rs`, let’s add `pub` to our `fn` declaration:
324324
325-
```{rust,ignore}
325+
```rust,ignore
326326
pub fn hello() -> String {
327327
"Hello!".to_string()
328328
}
329329
```
330330
331331
And also in `src/english/farewells.rs`:
332332
333-
```{rust,ignore}
333+
```rust,ignore
334334
pub fn goodbye() -> String {
335335
"Goodbye.".to_string()
336336
}
@@ -365,7 +365,7 @@ refer to them with shorter names. Let’s talk about `use`.
365365
Rust has a `use` keyword, which allows us to import names into our local scope.
366366
Let’s change our `src/main.rs` to look like this:
367367
368-
```{rust,ignore}
368+
```rust,ignore
369369
extern crate phrases;
370370

371371
use phrases::english::greetings;
@@ -382,7 +382,7 @@ the functions by a much shorter name. By convention, when importing functions, i
382382
considered best practice to import the module, rather than the function directly. In
383383
other words, you _can_ do this:
384384
385-
```{rust,ignore}
385+
```rust,ignore
386386
extern crate phrases;
387387

388388
use phrases::english::greetings::hello;
@@ -400,7 +400,7 @@ becomes a problem. If we have conflicting names, Rust will give a compilation
400400
error. For example, if we made the `japanese` functions public, and tried to do
401401
this:
402402
403-
```{rust,ignore}
403+
```rust,ignore
404404
extern crate phrases;
405405
406406
use phrases::english::greetings::hello;
@@ -426,14 +426,14 @@ Could not compile `phrases`.
426426
If we’re importing multiple names from the same module, we don’t have to type it out
427427
twice. Instead of this:
428428
429-
```{rust,ignore}
429+
```rust,ignore
430430
use phrases::english::greetings;
431431
use phrases::english::farewells;
432432
```
433433
434434
We can use this shortcut:
435435
436-
```{rust,ignore}
436+
```rust,ignore
437437
use phrases::english::{greetings, farewells};
438438
```
439439
@@ -445,7 +445,7 @@ interface that may not directly map to your internal code organization.
445445
446446
Let’s look at an example. Modify your `src/main.rs` to read like this:
447447
448-
```{rust,ignore}
448+
```rust,ignore
449449
extern crate phrases;
450450
451451
use phrases::english::{greetings,farewells};
@@ -462,30 +462,30 @@ fn main() {
462462
463463
Then, modify your `src/lib.rs` to make the `japanese` mod public:
464464
465-
```{rust,ignore}
465+
```rust,ignore
466466
pub mod english;
467467
pub mod japanese;
468468
```
469469
470470
Next, make the two functions public, first in `src/japanese/greetings.rs`:
471471
472-
```{rust,ignore}
472+
```rust,ignore
473473
pub fn hello() -> String {
474474
"こんにちは".to_string()
475475
}
476476
```
477477
478478
And then in `src/japanese/farewells.rs`:
479479
480-
```{rust,ignore}
480+
```rust,ignore
481481
pub fn goodbye() -> String {
482482
"さようなら".to_string()
483483
}
484484
```
485485
486486
Finally, modify your `src/japanese/mod.rs` to read like this:
487487
488-
```{rust,ignore}
488+
```rust,ignore
489489
pub use self::greetings::hello;
490490
pub use self::farewells::goodbye;
491491

src/doc/trpl/error-handling.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ We use `assert!` to declare that something is true. If it's not true, something
4949
is very wrong. Wrong enough that we can't continue with things in the current
5050
state. Another example is using the `unreachable!()` macro:
5151

52-
```{rust,ignore}
52+
```rust,ignore
5353
enum Event {
5454
NewRelease,
5555
}
@@ -188,7 +188,7 @@ The [`Debug`](../std/fmt/trait.Debug.html) trait is what lets us print the enum
188188
In the case of an error that is unexpected and not recoverable, the `panic!`
189189
macro will induce a panic. This will crash the current thread, and give an error:
190190

191-
```{rust,ignore}
191+
```rust,ignore
192192
panic!("boom");
193193
```
194194

@@ -212,7 +212,7 @@ handle and possibly recover from error.
212212
If we don't want to handle this error, and would rather just abort the program,
213213
we can use the `unwrap()` method:
214214

215-
```{rust,ignore}
215+
```rust,ignore
216216
io::stdin().read_line(&mut buffer).unwrap();
217217
```
218218

@@ -223,7 +223,7 @@ shorter. Sometimes, just crashing is appropriate.
223223

224224
There's another way of doing this that's a bit nicer than `unwrap()`:
225225

226-
```{rust,ignore}
226+
```rust,ignore
227227
let mut buffer = String::new();
228228
let input = io::stdin().read_line(&mut buffer)
229229
.ok()

src/doc/trpl/iterators.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ A *consumer* operates on an iterator, returning some kind of value or values.
116116
The most common consumer is `collect()`. This code doesn't quite compile,
117117
but it shows the intention:
118118

119-
```{rust,ignore}
119+
```rust,ignore
120120
let one_to_one_hundred = (1..101).collect();
121121
```
122122

@@ -253,7 +253,7 @@ we need to talk about with regards to iterators. Let's get to it!
253253
*Iterator adapters* take an iterator and modify it somehow, producing
254254
a new iterator. The simplest one is called `map`:
255255

256-
```{rust,ignore}
256+
```rust,ignore
257257
(1..100).map(|x| x + 1);
258258
```
259259

@@ -272,7 +272,7 @@ warning: unused result which must be used: iterator adaptors are lazy and
272272
Laziness strikes again! That closure will never execute. This example
273273
doesn't print any numbers:
274274

275-
```{rust,ignore}
275+
```rust,ignore
276276
(1..100).map(|x| println!("{}", x));
277277
```
278278

src/doc/trpl/testing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn it_works() {
205205

206206
That's all there is to the basics! Let's write one 'real' test:
207207

208-
```{rust,ignore}
208+
```rust,ignore
209209
pub fn add_two(a: i32) -> i32 {
210210
a + 2
211211
}
@@ -225,7 +225,7 @@ There is one way in which our existing example is not idiomatic: it's
225225
missing the `tests` module. The idiomatic way of writing our example
226226
looks like this:
227227

228-
```{rust,ignore}
228+
```rust,ignore
229229
pub fn add_two(a: i32) -> i32 {
230230
a + 2
231231
}
@@ -253,7 +253,7 @@ we need to bring our test function into scope. This can be annoying if you have
253253
a large module, and so this is a common use of the `glob` feature. Let's change
254254
our `src/lib.rs` to make use of it:
255255

256-
```{rust,ignore}
256+
```rust,ignore
257257
258258
pub fn add_two(a: i32) -> i32 {
259259
a + 2
@@ -302,7 +302,7 @@ the `tests` directory
302302
To write an integration test, let's make a `tests` directory, and
303303
put a `tests/lib.rs` file inside, with this as its contents:
304304

305-
```{rust,ignore}
305+
```rust,ignore
306306
extern crate adder;
307307
308308
#[test]
@@ -359,7 +359,7 @@ documentation has been written. To this end, Rust supports automatically
359359
running examples in your documentation. Here's a fleshed-out `src/lib.rs`
360360
with examples:
361361

362-
```{rust,ignore}
362+
```rust,ignore
363363
//! The `adder` crate provides functions that add numbers to other numbers.
364364
//!
365365
//! # Examples

src/doc/trpl/while-loops.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Rust also has a `while` loop. It looks like this:
44

5-
```{rust}
5+
```rust
66
let mut x = 5; // mut x: i32
77
let mut done = false; // mut done: bool
88

0 commit comments

Comments
 (0)