提交 eeae5520 编写于 作者: E Erick Tryzelaar

Revert "Simplify str::to_managed"

This reverts commit ac50046a.
上级 7dda8890
......@@ -2262,8 +2262,9 @@ impl &str: StrSlice {
#[inline]
pure fn to_managed() -> @str {
let bytes = as_bytes_slice(self);
let v = at_vec::from_fn(bytes.len(), |i| bytes[i]);
let v = at_vec::from_fn(self.len() + 1, |i| {
if i == self.len() { 0 } else { self[i] }
});
unsafe { ::cast::transmute(v) }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册