mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Fixed typo
This commit is contained in:
@ -37,13 +37,13 @@ fn main() {
|
|||||||
let bird = hatch_a_bird(2);
|
let bird = hatch_a_bird(2);
|
||||||
// this bird has forgotten how to swim, so below line will cause an error
|
// this bird has forgotten how to swim, so below line will cause an error
|
||||||
// bird.swim();
|
// bird.swim();
|
||||||
// but it can quak
|
// but it can quack
|
||||||
assert_eq!(bird.quack(), "duck duck");
|
assert_eq!(bird.quack(), "duck duck");
|
||||||
|
|
||||||
let bird = hatch_a_bird(1);
|
let bird = hatch_a_bird(1);
|
||||||
// this bird has forgotten how to fly, so below line will cause an error
|
// this bird has forgotten how to fly, so below line will cause an error
|
||||||
// bird.fly();
|
// bird.fly();
|
||||||
// but it can quak too
|
// but it can quack too
|
||||||
assert_eq!(bird.quack(), "swan swan");
|
assert_eq!(bird.quack(), "swan swan");
|
||||||
|
|
||||||
println!("Success!")
|
println!("Success!")
|
||||||
@ -95,7 +95,7 @@ fn main() {
|
|||||||
|
|
||||||
for bird in birds {
|
for bird in birds {
|
||||||
bird.quack();
|
bird.quack();
|
||||||
// when duck and swan turns into Bird, they all forgot how to fly, only remember how to quack
|
// when duck and swan turn into Bird, they all forget how to fly, and only remember how to quack
|
||||||
// so, the below code will cause an error
|
// so, the below code will cause an error
|
||||||
// bird.fly();
|
// bird.fly();
|
||||||
}
|
}
|
||||||
@ -223,4 +223,4 @@ fn main() {
|
|||||||
my_function(Box::new(13_u32));
|
my_function(Box::new(13_u32));
|
||||||
my_function(Box::new(String::from("abc")));
|
my_function(Box::new(String::from("abc")));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user