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:
parent
dee5e654c8
commit
c6a54ce9a9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user