Skip to content

[ios] std: avoid result::fold #27088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/libstd/sys/unix/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ use sys_common::backtrace::*;
#[cfg(all(target_os = "ios", target_arch = "arm"))]
#[inline(never)]
pub fn write(w: &mut Write) -> io::Result<()> {
use result;

extern {
fn backtrace(buf: *mut *mut libc::c_void,
sz: libc::c_int) -> libc::c_int;
Expand All @@ -127,10 +125,10 @@ pub fn write(w: &mut Write) -> io::Result<()> {
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as usize};

// skipping the first one as it is write itself
let iter = (1..cnt).map(|i| {
print(w, i as isize, buf[i], buf[i])
});
result::fold(iter, (), |_, _| ())
for i in 1..cnt {
try!(print(w, i as isize, buf[i], buf[i]))
}
Ok(())
}

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