Skip to content

Commit 5f9a1df

Browse files
committed
[ios] std: avoid result::fold
1 parent e4e9319 commit 5f9a1df

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/libstd/sys/unix/backtrace.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ use sys_common::backtrace::*;
107107
#[cfg(all(target_os = "ios", target_arch = "arm"))]
108108
#[inline(never)]
109109
pub fn write(w: &mut Write) -> io::Result<()> {
110-
use result;
111-
112110
extern {
113111
fn backtrace(buf: *mut *mut libc::c_void,
114112
sz: libc::c_int) -> libc::c_int;
@@ -127,10 +125,10 @@ pub fn write(w: &mut Write) -> io::Result<()> {
127125
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as usize};
128126

129127
// skipping the first one as it is write itself
130-
let iter = (1..cnt).map(|i| {
131-
print(w, i as isize, buf[i], buf[i])
132-
});
133-
result::fold(iter, (), |_, _| ())
128+
for i in 1..cnt {
129+
try!(print(w, i as isize, buf[i], buf[i]))
130+
}
131+
Ok(())
134132
}
135133

136134
#[cfg(not(all(target_os = "ios", target_arch = "arm")))]

0 commit comments

Comments
 (0)