1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-05 16:10:31 +02:00

Show the pair returned by duplicate (#314)

This makes it easier to talk about the code as you make changes to the
`duplicate` function.
This commit is contained in:
Martin Geisler 2023-01-31 21:08:09 +01:00 committed by GitHub
parent dee5e654c8
commit c6a54ce9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,12 +13,13 @@ fn duplicate<T: Clone>(a: T) -> (T, T) {
fn main() {
let foo = String::from("foo");
let pair = duplicate(foo);
println!("{pair:?}");
}
```
<details>
Consider showing a `where` clause syntax. Students can encounter it too when reading code.
Show a `where` clause, students will encounter it when reading code.
```rust,ignore
fn duplicate<T>(a: T) -> (T, T)