Skip to content

Commit e73a899

Browse files
authored
Merge pull request #1222 from Rosto75/pr
Fix several shell output and code highlights.
2 parents 7d0357d + 223c50d commit e73a899

20 files changed

+31
-31
lines changed

src/attribute/cfg/custom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Try to run this to see what happens without the custom `cfg` flag.
1818

1919
With the custom `cfg` flag:
2020

21-
```bash
21+
```shell
2222
$ rustc --cfg some_condition custom.rs && ./custom
2323
condition met!
2424
```

src/attribute/crate.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn indirect_access() {
3333
When the `crate_type` attribute is used, we no longer need to pass the
3434
`--crate-type` flag to `rustc`.
3535

36-
```bash
36+
```shell
3737
$ rustc lib.rs
3838
$ ls lib*
3939
library.rlib

src/cargo/test.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ Each file in `tests` is a separate integration test.
2323

2424
`cargo` naturally provides an easy way to run all of your tests!
2525

26-
```sh
27-
cargo test
26+
```shell
27+
$ cargo test
2828
```
2929

3030
You should see output like this:
3131

32-
```txt
32+
```shell
3333
$ cargo test
3434
Compiling blah v0.1.0 (file:///nobackup/blah)
3535
Finished dev [unoptimized + debuginfo] target(s) in 0.89 secs
@@ -46,11 +46,11 @@ test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
4646

4747
You can also run tests whose name matches a pattern:
4848

49-
```sh
50-
cargo test test_foo
49+
```shell
50+
$ cargo test test_foo
5151
```
5252

53-
```txt
53+
```shell
5454
$ cargo test test_foo
5555
Compiling blah v0.1.0 (file:///nobackup/blah)
5656
Finished dev [unoptimized + debuginfo] target(s) in 0.35 secs

src/crates/lib.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn indirect_access() {
1818
}
1919
```
2020

21-
```bash
21+
```shell
2222
$ rustc --crate-type=lib rary.rs
2323
$ ls lib*
2424
library.rlib

src/crates/link.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() {
1919
}
2020
```
2121

22-
```bash
22+
```txt
2323
# Where library.rlib is the path to the compiled library, assumed that it's
2424
# in the same directory here:
2525
$ rustc executable.rs --extern rary=library.rlib && ./executable

src/macros/dry.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ mod test {
6464
}
6565
```
6666

67-
```bash
67+
```shell
6868
$ rustc --test dry.rs && ./dry
6969
running 3 tests
7070
test test::mul_assign ... ok

src/meta/doc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn main() {
6060
To run the tests, first build the code as a library, then tell rustdoc where
6161
to find the library so it can link it into each doctest program:
6262

63-
```bash
63+
```shell
6464
$ rustc doc.rs --crate-type lib
6565
$ rustdoc --test --extern doc="libdoc.rlib" doc.rs
6666
```

src/mod/split.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Modules can be mapped to a file/directory hierarchy. Let's break down the
44
[visibility example][visibility] in files:
55

6-
```bash
6+
```shell
77
$ tree .
88
.
99
|-- my
@@ -84,7 +84,7 @@ pub fn public_function() {
8484

8585
Let's check that things still work as before:
8686

87-
```bash
87+
```shell
8888
$ rustc split.rs && ./split
8989
called `my::function()`
9090
called `function()`

src/scope/raii.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141

4242
Of course, we can double check for memory errors using [`valgrind`][valgrind]:
4343

44-
```bash
44+
```shell
4545
$ rustc raii.rs && valgrind ./raii
4646
==26873== Memcheck, a memory error detector
4747
==26873== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.

src/std/panic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434

3535
Let's check that `panic!` doesn't leak memory.
3636

37-
```bash
37+
```shell
3838
$ rustc panic.rs && valgrind ./panic
3939
==4401== Memcheck, a memory error detector
4040
==4401== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.

src/std_misc/arg.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
}
2222
```
2323

24-
```bash
24+
```shell
2525
$ ./args 1 2 3
2626
My path is ./args.
2727
I got 3 arguments: ["1", "2", "3"].

src/std_misc/arg/matching.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn main() {
7070
}
7171
```
7272

73-
```bash
73+
```shell
7474
$ ./match_args Rust
7575
This is not the answer.
7676
$ ./match_args 42

src/std_misc/file/create.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() {
3939

4040
Here's the expected successful output:
4141

42-
```bash
42+
```shell
4343
$ mkdir out
4444
$ rustc create.rs && ./create
4545
successfully wrote to out/lorem_ipsum.txt

src/std_misc/file/open.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040

4141
Here's the expected successful output:
4242

43-
```bash
43+
```shell
4444
$ echo "Hello World!" > hello.txt
4545
$ rustc open.rs && ./open
4646
hello.txt contains:

src/std_misc/file/read_lines.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where P: AsRef<Path>, {
3333
```
3434

3535
Running this program simply prints the lines individually.
36-
```bash
36+
```shell
3737
$ echo -e "127.0.0.1\n192.168.0.1\n" > hosts
3838
$ rustc read_lines.rs && ./read_lines
3939
127.0.0.1

src/std_misc/fs.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn main() {
100100

101101
Here's the expected successful output:
102102

103-
```bash
103+
```shell
104104
$ rustc fs.rs && ./fs
105105
`mkdir a`
106106
`echo hello > a/b.txt`
@@ -118,7 +118,7 @@ $ rustc fs.rs && ./fs
118118

119119
And the final state of the `a` directory is:
120120

121-
```text
121+
```shell
122122
$ tree a
123123
a
124124
|-- b.txt

src/testing/dev_dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages which depend on this package.
88
One such example is using a crate that extends standard `assert!` macros.
99
File `Cargo.toml`:
1010

11-
```ignore
11+
```toml
1212
# standard crate data is left out
1313
[dev-dependencies]
1414
pretty_assertions = "0.4.0"

src/testing/doc_testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn div(a: i32, b: i32) -> i32 {
5050

5151
Tests can be run with `cargo test`:
5252

53-
```bash
53+
```shell
5454
$ cargo test
5555
running 0 tests
5656

src/testing/integration_testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn test_add() {
3030

3131
Running tests with `cargo test` command:
3232

33-
```bash
33+
```shell
3434
$ cargo test
3535
running 0 tests
3636

src/testing/unit_testing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod tests {
4848

4949
Tests can be run with `cargo test`.
5050

51-
```bash
51+
```shell
5252
$ cargo test
5353

5454
running 2 tests
@@ -112,7 +112,7 @@ mod tests {
112112

113113
Running these tests gives us:
114114

115-
```bash
115+
```shell
116116
$ cargo test
117117

118118
running 3 tests
@@ -133,7 +133,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
133133

134134
To run specific tests one may specify the test name to `cargo test` command.
135135

136-
```bash
136+
```shell
137137
$ cargo test test_any_panic
138138
running 1 test
139139
test tests::test_any_panic ... ok
@@ -150,7 +150,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
150150
To run multiple tests one may specify part of a test name that matches all the
151151
tests that should be run.
152152

153-
```bash
153+
```shell
154154
$ cargo test panic
155155
running 2 tests
156156
test tests::test_any_panic ... ok
@@ -198,7 +198,7 @@ mod tests {
198198
}
199199
```
200200

201-
```bash
201+
```shell
202202
$ cargo test
203203
running 1 test
204204
test tests::ignored_test ... ignored

0 commit comments

Comments
 (0)