Skip to content

Commit 3c459bb

Browse files
committed
ch18 パターンとマッチングの和訳を最新版に更新
rust-lang/book@19c40bf
1 parent d61d23d commit 3c459bb

File tree

61 files changed

+478
-950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+478
-950
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch18-patterns-and-matching/listing-18-01/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ fn main() {
44
let age: Result<u8, _> = "34".parse();
55

66
if let Some(color) = favorite_color {
7-
println!("Using your favorite color, {}, as the background", color);
7+
// "あなたのお気に入りの色、{color}を背景色に使用します"
8+
println!("Using your favorite color, {color}, as the background");
89
} else if is_tuesday {
10+
// "火曜日は緑の日!"
911
println!("Tuesday is green day!");
1012
} else if let Ok(age) = age {
1113
if age > 30 {
14+
// "紫を背景色に使用します"
1215
println!("Using purple as the background color");
1316
} else {
17+
// "オレンジを背景色に使用します"
1418
println!("Using orange as the background color");
1519
}
1620
} else {
21+
// "青を背景色に使用します"
1722
println!("Using blue as the background color");
1823
}
1924
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch18-patterns-and-matching/listing-18-05/output.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ error[E0308]: mismatched types
44
--> src/main.rs:2:9
55
|
66
2 | let (x, y) = (1, 2, 3);
7-
| ^^^^^^ expected a tuple with 3 elements, found one with 2 elements
7+
| ^^^^^^ --------- this expression has type `({integer}, {integer}, {integer})`
8+
| | (この式は型`({integer}, {integer}, {integer})`を持ちます)
9+
| |
10+
| expected a tuple with 3 elements, found one with 2 elements
11+
| (3要素のタプルを予期したのに、2要素のタプルが見つかりました)
812
|
913
= note: expected tuple `({integer}, {integer}, {integer})`
1014
found tuple `(_, _)`
1115

12-
error: aborting due to previous error
13-
1416
For more information about this error, try `rustc --explain E0308`.
15-
error: could not compile `patterns`.
16-
17-
To learn more, run the command again with --verbose.
17+
error: could not compile `patterns` (bin "patterns") due to 1 previous error
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "patterns"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch18-patterns-and-matching/listing-18-07/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fn print_coordinates(&(x, y): &(i32, i32)) {
2+
// "現在の位置: ({}, {})"
23
println!("Current location: ({}, {})", x, y);
34
}
45

0 commit comments

Comments
 (0)