You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-06 14:35:36 +02:00
Fix minor inconsistencies and naming issues (#2563)
This commit is contained in:
committed by
GitHub
parent
58bf01f1ef
commit
9e5c318a57
@ -9,12 +9,12 @@ Rust allows you to associate functions with your new types. You do this with an
|
||||
|
||||
```rust,editable
|
||||
#[derive(Debug)]
|
||||
struct Race {
|
||||
struct CarRace {
|
||||
name: String,
|
||||
laps: Vec<i32>,
|
||||
}
|
||||
|
||||
impl Race {
|
||||
impl CarRace {
|
||||
// No receiver, a static method
|
||||
fn new(name: &str) -> Self {
|
||||
Self { name: String::from(name), laps: Vec::new() }
|
||||
@ -41,7 +41,7 @@ impl Race {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut race = Race::new("Monaco Grand Prix");
|
||||
let mut race = CarRace::new("Monaco Grand Prix");
|
||||
race.add_lap(70);
|
||||
race.add_lap(68);
|
||||
race.print_laps();
|
||||
|
Reference in New Issue
Block a user