1
0
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:
Gergely Risko 2024-02-14 14:57:56 +01:00 committed by GitHub
parent 5d9ab5f239
commit aaef818b23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");
}
```