mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-13 16:16:28 +00:00
Co-ordinates -> Coordinates
Some checks failed
Rustlings Tests / clippy (push) Has been cancelled
Rustlings Tests / fmt (push) Has been cancelled
Rustlings Tests / test (macOS-latest) (push) Has been cancelled
Rustlings Tests / test (ubuntu-latest) (push) Has been cancelled
Rustlings Tests / test (windows-latest) (push) Has been cancelled
Rustlings Tests / dev-check (push) Has been cancelled
Web / Build and deploy site and docs (push) Has been cancelled
Some checks failed
Rustlings Tests / clippy (push) Has been cancelled
Rustlings Tests / fmt (push) Has been cancelled
Rustlings Tests / test (macOS-latest) (push) Has been cancelled
Rustlings Tests / test (ubuntu-latest) (push) Has been cancelled
Rustlings Tests / test (windows-latest) (push) Has been cancelled
Rustlings Tests / dev-check (push) Has been cancelled
Web / Build and deploy site and docs (push) Has been cancelled
This commit is contained in:
parent
53ec59ed95
commit
bde6f7470c
2 changed files with 4 additions and 3 deletions
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
|
|
||||||
// TODO: Fix the compiler error by adding something to this match statement.
|
// TODO: Fix the compiler error by adding something to this match statement.
|
||||||
match optional_point {
|
match optional_point {
|
||||||
Some(p) => println!("Co-ordinates are {},{}", p.x, p.y),
|
Some(p) => println!("Coordinates are {},{}", p.x, p.y),
|
||||||
_ => panic!("No match!"),
|
_ => panic!("No match!"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
// Solution 1: Matching over the `Option` (not `&Option`) but without moving
|
// Solution 1: Matching over the `Option` (not `&Option`) but without moving
|
||||||
// out of the `Some` variant.
|
// out of the `Some` variant.
|
||||||
match optional_point {
|
match optional_point {
|
||||||
Some(ref p) => println!("Co-ordinates are {},{}", p.x, p.y),
|
Some(ref p) => println!("Coordinates are {},{}", p.x, p.y),
|
||||||
// ^^^ added
|
// ^^^ added
|
||||||
_ => panic!("No match!"),
|
_ => panic!("No match!"),
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ fn main() {
|
||||||
// Solution 2: Matching over a reference (`&Option`) by added `&` before
|
// Solution 2: Matching over a reference (`&Option`) by added `&` before
|
||||||
// `optional_point`.
|
// `optional_point`.
|
||||||
match &optional_point {
|
match &optional_point {
|
||||||
Some(p) => println!("Co-ordinates are {},{}", p.x, p.y),
|
//^ added
|
||||||
|
Some(p) => println!("Coordinates are {},{}", p.x, p.y),
|
||||||
_ => panic!("No match!"),
|
_ => panic!("No match!"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue