mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-13 18:38:22 +02:00
Make content of variable "name" an actual name (#1816)
In the example, somebody who is trying to understand this code has to follow a lot of moving pieces: prefix, name, make_greeter, and then also learn the new move concept at the same time. It'd be better if the content were to actually match the name of the variables. "Hi" is a good prefix, but "there" is not a name, so let's go with an actual name.
This commit is contained in:
parent
5d9ab5f239
commit
aaef818b23
@ -68,7 +68,7 @@ fn make_greeter(prefix: String) -> impl Fn(&str) {
|
||||
|
||||
fn main() {
|
||||
let hi = make_greeter("Hi".to_string());
|
||||
hi("there");
|
||||
hi("Greg");
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user