Skip to content

Commit a18c3c4

Browse files
authored
Merge pull request #1173 from alexander-clarke/small-fixes
Small improvements to various files
2 parents d7c5489 + aaddc14 commit a18c3c4

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

src/crates/lib.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Let's create a library, and then see how to link it to another crate.
44

5-
```rust,editable
5+
```rust,ignore
66
pub fn public_function() {
77
println!("called rary's `public_function()`");
88
}

src/custom_types/enum.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ different variants. Any variant which is valid as a `struct` is also valid as
55
an `enum`.
66

77
```rust,editable
8-
// An attribute to hide warnings for unused code.
9-
#![allow(dead_code)]
10-
118
// Create an `enum` to classify a web event. Note how both
129
// names and type information together specify the variant:
1310
// `PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`.
@@ -58,9 +55,8 @@ fn main() {
5855

5956
### See also:
6057

61-
[`attributes`][attributes], [`match`][match], [`fn`][fn], and [`String`][str]
58+
[`match`][match], [`fn`][fn], and [`String`][str]
6259

63-
[attributes]: attribute.html
6460
[c_struct]: https://en.wikipedia.org/wiki/Struct_(C_programming_language)
6561
[match]: flow_control/match.html
6662
[fn]: fn.html

src/flow_control/match/destructuring/destructure_structures.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ Similarly, a `struct` can be destructured as shown:
44

55
```rust,editable
66
fn main() {
7-
struct Foo { x: (u32, u32), y: u32 }
7+
struct Foo {
8+
x: (u32, u32),
9+
y: u32,
10+
}
811
9-
// destructure members of the struct
12+
// Try changing the values in the struct to see what happens
1013
let foo = Foo { x: (1, 2), y: 3 };
11-
let Foo { x: (a, b), y } = foo;
1214
13-
println!("a = {}, b = {}, y = {} ", a, b, y);
15+
match foo {
16+
Foo { x: (1, b), y } => println!("First of x is 1, b = {}, y = {} ", b, y),
1417
15-
// you can destructure structs and rename the variables,
16-
// the order is not important
18+
// you can destructure structs and rename the variables,
19+
// the order is not important
20+
Foo { y: 2, x: i } => println!("y is 2, i = {:?}", i),
1721
18-
let Foo { y: i, x: j } = foo;
19-
println!("i = {:?}, j = {:?}", i, j);
20-
21-
// and you can also ignore some variables:
22-
let Foo { y, .. } = foo;
23-
println!("y = {}", y);
24-
25-
// this will give an error: pattern does not mention field `x`
26-
// let Foo { y } = foo;
22+
// and you can also ignore some variables:
23+
Foo { y, .. } => println!("y = {}, we don't care about x", y),
24+
// this will give an error: pattern does not mention field `x`
25+
//Foo { y } => println!("y = {}", y);
26+
}
2727
}
2828
```
2929

src/meta/doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Doc comments are very useful for big projects that require documentation. When
44
running [Rustdoc][1], these are the comments that get compiled into
55
documentation. They are denoted by a `///`, and support [Markdown][2].
66

7-
```rust,editable,ignore,mdbook-runnable
7+
```rust,editable,ignore
88
#![crate_name = "doc"]
99
1010
/// A human being is represented here

0 commit comments

Comments
 (0)