]> git.lizzy.rs Git - rust.git/commit
Auto merge of #51081 - kornelski:examplestr, r=steveklabnik
authorbors <bors@rust-lang.org>
Tue, 19 Jun 2018 13:09:04 +0000 (13:09 +0000)
committerbors <bors@rust-lang.org>
Tue, 19 Jun 2018 13:09:04 +0000 (13:09 +0000)
commita646c912f76412921b27b426a1da83e7df981dcc
treebba0a543c01ddbae6175a4f7833473625c3aa260
parent72b0f915ba84e08cd21c799e859d2329e95ab004
parent01e82f111e618c5907b93504df29aec152821810
Auto merge of #51081 - kornelski:examplestr, r=steveklabnik

Use String, not &str in some collection examples

Discussed in #46966

Overuse of borrowed values in data structures is a common mistake I see in Rust user forums. Users who copy&paste such examples end up fighting with the borrow checker as soon as they replace string literals with some real values.

This changes a couple of examples to use `String`, and it adds opportunity to demonstrate use of `Borrow`.