about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-12-01 01:05:51 +0800
committerGitHub <noreply@github.com>2018-12-01 01:05:51 +0800
commitc3950c84c0ce89d6aad6f95042836912ce3ff3dc (patch)
tree1e36efb761987cc72d3f8a519dc0516f67e76b92 /src/liballoc
parente40f37e39dd1cbb0b6158bf120931f6cc4a0c43b (diff)
parent591607d237665857880e16899788517b9b82d414 (diff)
downloadrust-c3950c84c0ce89d6aad6f95042836912ce3ff3dc.tar.gz
rust-c3950c84c0ce89d6aad6f95042836912ce3ff3dc.zip
Rollup merge of #56131 - ljedrz:assorted, r=RalfJung
Assorted tweaks

- preallocate `VecDeque` in `Decodable::decode` (as it is done with other collections which can do it)
- add a FIXME to `String::from_utf16`

r? @RalfJung
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/string.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 8d009101ce7..0b25d911a29 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -618,6 +618,8 @@ impl String {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
+        // This isn't done via collect::<Result<_, _>>() for performance reasons.
+        // FIXME: the function can be simplified again when #48994 is closed.
         let mut ret = String::with_capacity(v.len());
         for c in decode_utf16(v.iter().cloned()) {
             if let Ok(c) = c {