diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2016-03-22 22:01:37 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2016-03-22 22:01:37 -0500 |
| commit | 0f02309e4b0ea05ee905205278fb6d131341c41f (patch) | |
| tree | a259129eeb84705de15b51587ddebd0f82735075 /src/libstd/sys/common/backtrace.rs | |
| parent | 0dcc413e42f15f4fc51a0ca88a99cc89454ec43d (diff) | |
| download | rust-0f02309e4b0ea05ee905205278fb6d131341c41f.tar.gz rust-0f02309e4b0ea05ee905205278fb6d131341c41f.zip | |
try! -> ?
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
Diffstat (limited to 'src/libstd/sys/common/backtrace.rs')
| -rw-r--r-- | src/libstd/sys/common/backtrace.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs index 3c84783d215..b81fb3011c7 100644 --- a/src/libstd/sys/common/backtrace.rs +++ b/src/libstd/sys/common/backtrace.rs @@ -46,10 +46,10 @@ pub fn log_enabled() -> bool { // These output functions should now be used everywhere to ensure consistency. pub fn output(w: &mut Write, idx: isize, addr: *mut libc::c_void, s: Option<&[u8]>) -> io::Result<()> { - try!(write!(w, " {:2}: {:2$?} - ", idx, addr, HEX_WIDTH)); + write!(w, " {:2}: {:2$?} - ", idx, addr, HEX_WIDTH)?; match s.and_then(|s| str::from_utf8(s).ok()) { - Some(string) => try!(demangle(w, string)), - None => try!(write!(w, "<unknown>")), + Some(string) => demangle(w, string)?, + None => write!(w, "<unknown>")?, } w.write_all(&['\n' as u8]) } @@ -59,9 +59,9 @@ pub fn output_fileline(w: &mut Write, file: &[u8], line: libc::c_int, more: bool) -> io::Result<()> { let file = str::from_utf8(file).unwrap_or("<unknown>"); // prior line: " ##: {:2$} - func" - try!(write!(w, " {:3$}at {}:{}", "", file, line, HEX_WIDTH)); + write!(w, " {:3$}at {}:{}", "", file, line, HEX_WIDTH)?; if more { - try!(write!(w, " <... and possibly more>")); + write!(w, " <... and possibly more>")?; } w.write_all(&['\n' as u8]) } @@ -121,12 +121,12 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> { // Alright, let's do this. if !valid { - try!(writer.write_all(s.as_bytes())); + writer.write_all(s.as_bytes())?; } else { let mut first = true; while !inner.is_empty() { if !first { - try!(writer.write_all(b"::")); + writer.write_all(b"::")?; } else { first = false; } @@ -177,7 +177,7 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> { None => rest.len(), Some(i) => i, }; - try!(writer.write_all(rest[..idx].as_bytes())); + writer.write_all(rest[..idx].as_bytes())?; rest = &rest[idx..]; } } |
