]> git.lizzy.rs Git - rust.git/commitdiff
String: add a FIXME to from_utf16
authorljedrz <ljedrz@gmail.com>
Wed, 21 Nov 2018 09:17:54 +0000 (10:17 +0100)
committerljedrz <ljedrz@gmail.com>
Wed, 21 Nov 2018 09:17:54 +0000 (10:17 +0100)
src/liballoc/string.rs

index 8d009101ce7da2d3865754d6184e87bf8400d976..0b25d911a299cf84ded7246311d691e74493c2ce 100644 (file)
@@ -618,6 +618,8 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> Cow<'a, str> {
     /// ```
     #[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 {