about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@gmail.com>2018-08-23 08:38:41 -0700
committerGitHub <noreply@github.com>2018-08-23 08:38:41 -0700
commit6a0703664b5f57b797a44d9552d660ec4177611b (patch)
treeadd43bfff639d2b3fc3e9a2e1793876cecb608df /tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
parente9c3d3d50261b9cc6143dc02885cda265e926d30 (diff)
downloadrust-6a0703664b5f57b797a44d9552d660ec4177611b.tar.gz
rust-6a0703664b5f57b797a44d9552d660ec4177611b.zip
Remove incorrect note from string_add_assign docs
The docs claim that `String::push_str` is better than `String::add` because `String::add` allocates a new string and drops the old one, but this is not true.  In fact, `add` reuses the existing string and grows it only if its capacity is exceeded, exactly like `push_str`.  Their performance is identical since `add` is just a wrapper for `push_str`:

```
    fn add(mut self, other: &str) -> String {
        self.push_str(other);
        self
    }
```

https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/liballoc/string.rs#L1922-L1925
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions