Skip to content

Commit

Permalink
String: add a FIXME to from_utf16
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Nov 21, 2018
1 parent 464c9da commit 591607d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 591607d

Please sign in to comment.