mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-09 02:56:15 +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() {
|
fn main() {
|
||||||
let foo = String::from("foo");
|
let foo = String::from("foo");
|
||||||
let pair = duplicate(foo);
|
let pair = duplicate(foo);
|
||||||
|
println!("{pair:?}");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<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
|
```rust,ignore
|
||||||
fn duplicate<T>(a: T) -> (T, T)
|
fn duplicate<T>(a: T) -> (T, T)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user