Add note about temporaries

This commit is contained in:
Steve Klabnik 2016-02-02 11:15:45 -05:00
parent dc3a39d807
commit 6c907212b4

View File

@ -196,8 +196,16 @@ let (x, _) = tuple;
println!("Tuple is: {:?}", tuple);
```
In a similar fashion to `_`, you can use `..` in a pattern to disregard
multiple values:
This also means that any temporary variables will be dropped at the end of the
statement:
```rust
// Here, the String created will be dropped immediately, as its not bound:
let _ = String::from(" hello ").trim();
```
You can also use `..` in a pattern to disregard multiple values:
```rust
enum OptionalTuple {