From ba5cab1fe0a1cb6f3de5a338a8009b5b649a80c3 Mon Sep 17 00:00:00 2001
From: Erick Tryzelaar <erick.tryzelaar@gmail.com>
Date: Thu, 16 Jun 2016 21:16:55 +0100
Subject: [PATCH] Revert using ? for try! in the libsyntax pretty printer

The use of ...?instead of try!(...) in libsyntax makes
extracting libsyntax into syntex quite painful since it's
not stable yet. This makes backports take a much longer time
and causes a lot of problems for the syntex dependencies. Even
if it was, it'd take a few release cycles until syntex would
be able to use it. Since it's not stable and that this feature
is just syntax sugar, it would be most helpful if we could remove
it.

cc #34311
---
 src/libsyntax/print/pprust.rs | 1712 ++++++++++++++++-----------------
 1 file changed, 856 insertions(+), 856 deletions(-)

diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 8818acf9aef..0c90e102f34 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -123,16 +123,16 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
         let list = attr::mk_list_item(InternedString::new("feature"),
                                       vec![prelude_import_meta]);
         let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), list);
-        s.print_attribute(&fake_attr)?;
+        try!(s.print_attribute(&fake_attr));
 
         // #![no_std]
         let no_std_meta = attr::mk_word_item(InternedString::new("no_std"));
         let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), no_std_meta);
-        s.print_attribute(&fake_attr)?;
+        try!(s.print_attribute(&fake_attr));
     }
 
-    s.print_mod(&krate.module, &krate.attrs)?;
-    s.print_remaining_comments()?;
+    try!(s.print_mod(&krate.module, &krate.attrs));
+    try!(s.print_remaining_comments());
     eof(&mut s.s)
 }
 
@@ -385,10 +385,10 @@ pub fn fun_to_string(decl: &ast::FnDecl,
                      generics: &ast::Generics)
                      -> String {
     to_string(|s| {
-        s.head("")?;
-        s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name),
-                   generics, &ast::Visibility::Inherited)?;
-        s.end()?; // Close the head box
+        try!(s.head(""));
+        try!(s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name),
+                   generics, &ast::Visibility::Inherited));
+        try!(s.end()); // Close the head box
         s.end() // Close the outer box
     })
 }
@@ -396,9 +396,9 @@ pub fn fun_to_string(decl: &ast::FnDecl,
 pub fn block_to_string(blk: &ast::Block) -> String {
     to_string(|s| {
         // containing cbox, will be closed by print-block at }
-        s.cbox(INDENT_UNIT)?;
+        try!(s.cbox(INDENT_UNIT));
         // head-ibox, will be closed by print-block after {
-        s.ibox(0)?;
+        try!(s.ibox(0));
         s.print_block(blk)
     })
 }
@@ -454,7 +454,7 @@ pub trait PrintState<'a> {
     fn literals(&self) -> &Option<Vec<comments::Literal>>;
 
     fn word_space(&mut self, w: &str) -> io::Result<()> {
-        word(self.writer(), w)?;
+        try!(word(self.writer(), w));
         space(self.writer())
     }
 
@@ -483,7 +483,7 @@ pub trait PrintState<'a> {
 
     fn hardbreak_if_not_bol(&mut self) -> io::Result<()> {
         if !self.is_bol() {
-            hardbreak(self.writer())?
+            try!(hardbreak(self.writer()))
         }
         Ok(())
     }
@@ -507,11 +507,11 @@ pub trait PrintState<'a> {
     fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], mut op: F) -> io::Result<()>
         where F: FnMut(&mut Self, &T) -> io::Result<()>,
     {
-        self.rbox(0, b)?;
+        try!(self.rbox(0, b));
         let mut first = true;
         for elt in elts {
-            if first { first = false; } else { self.word_space(",")?; }
-            op(self, elt)?;
+            if first { first = false; } else { try!(self.word_space(",")); }
+            try!(op(self, elt));
         }
         self.end()
     }
@@ -543,7 +543,7 @@ pub trait PrintState<'a> {
             match self.next_comment() {
                 Some(ref cmnt) => {
                     if (*cmnt).pos < pos {
-                        self.print_comment(cmnt)?;
+                        try!(self.print_comment(cmnt));
                         self.cur_cmnt_and_lit().cur_cmnt += 1;
                     } else { break; }
                 }
@@ -558,34 +558,34 @@ pub trait PrintState<'a> {
         match cmnt.style {
             comments::Mixed => {
                 assert_eq!(cmnt.lines.len(), 1);
-                zerobreak(self.writer())?;
-                word(self.writer(), &cmnt.lines[0])?;
+                try!(zerobreak(self.writer()));
+                try!(word(self.writer(), &cmnt.lines[0]));
                 zerobreak(self.writer())
             }
             comments::Isolated => {
-                self.hardbreak_if_not_bol()?;
+                try!(self.hardbreak_if_not_bol());
                 for line in &cmnt.lines {
                     // Don't print empty lines because they will end up as trailing
                     // whitespace
                     if !line.is_empty() {
-                        word(self.writer(), &line[..])?;
+                        try!(word(self.writer(), &line[..]));
                     }
-                    hardbreak(self.writer())?;
+                    try!(hardbreak(self.writer()));
                 }
                 Ok(())
             }
             comments::Trailing => {
-                word(self.writer(), " ")?;
+                try!(word(self.writer(), " "));
                 if cmnt.lines.len() == 1 {
-                    word(self.writer(), &cmnt.lines[0])?;
+                    try!(word(self.writer(), &cmnt.lines[0]));
                     hardbreak(self.writer())
                 } else {
-                    self.ibox(0)?;
+                    try!(self.ibox(0));
                     for line in &cmnt.lines {
                         if !line.is_empty() {
-                            word(self.writer(), &line[..])?;
+                            try!(word(self.writer(), &line[..]));
                         }
-                        hardbreak(self.writer())?;
+                        try!(hardbreak(self.writer()));
                     }
                     self.end()
                 }
@@ -597,7 +597,7 @@ pub trait PrintState<'a> {
                     _ => false
                 };
                 if is_semi || self.is_begin() || self.is_end() {
-                    hardbreak(self.writer())?;
+                    try!(hardbreak(self.writer()));
                 }
                 hardbreak(self.writer())
             }
@@ -619,7 +619,7 @@ pub trait PrintState<'a> {
     }
 
     fn print_literal(&mut self, lit: &ast::Lit) -> io::Result<()> {
-        self.maybe_print_comment(lit.span.lo)?;
+        try!(self.maybe_print_comment(lit.span.lo));
         match self.next_lit(lit.span.lo) {
             Some(ref ltrl) => {
                 return word(self.writer(), &(*ltrl).lit);
@@ -725,15 +725,15 @@ pub trait PrintState<'a> {
         let mut count = 0;
         for attr in attrs {
             if attr.node.style == kind {
-                    self.print_attribute_inline(attr, is_inline)?;
-                    if is_inline {
-                        self.nbsp()?;
-                    }
-                    count += 1;
+                try!(self.print_attribute_inline(attr, is_inline));
+                if is_inline {
+                    try!(self.nbsp());
+                }
+                count += 1;
             }
         }
         if count > 0 && trailing_hardbreak && !is_inline {
-            self.hardbreak_if_not_bol()?;
+            try!(self.hardbreak_if_not_bol());
         }
         Ok(())
     }
@@ -745,47 +745,47 @@ pub trait PrintState<'a> {
     fn print_attribute_inline(&mut self, attr: &ast::Attribute,
                               is_inline: bool) -> io::Result<()> {
         if !is_inline {
-            self.hardbreak_if_not_bol()?;
+            try!(self.hardbreak_if_not_bol());
         }
-        self.maybe_print_comment(attr.span.lo)?;
+        try!(self.maybe_print_comment(attr.span.lo));
         if attr.node.is_sugared_doc {
-            word(self.writer(), &attr.value_str().unwrap())?;
+            try!(word(self.writer(), &attr.value_str().unwrap()));
             hardbreak(self.writer())
         } else {
             match attr.node.style {
-                ast::AttrStyle::Inner => word(self.writer(), "#![")?,
-                ast::AttrStyle::Outer => word(self.writer(), "#[")?,
+                ast::AttrStyle::Inner => try!(word(self.writer(), "#![")),
+                ast::AttrStyle::Outer => try!(word(self.writer(), "#[")),
             }
-            self.print_meta_item(&attr.meta())?;
+            try!(self.print_meta_item(&attr.meta()));
             word(self.writer(), "]")
         }
     }
 
     fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         match item.node {
             ast::MetaItemKind::Word(ref name) => {
-                word(self.writer(), &name)?;
+                try!(word(self.writer(), &name));
             }
             ast::MetaItemKind::NameValue(ref name, ref value) => {
-                self.word_space(&name[..])?;
-                self.word_space("=")?;
-                self.print_literal(value)?;
+                try!(self.word_space(&name[..]));
+                try!(self.word_space("="));
+                try!(self.print_literal(value));
             }
             ast::MetaItemKind::List(ref name, ref items) => {
-                word(self.writer(), &name)?;
-                self.popen()?;
-                self.commasep(Consistent,
+                try!(word(self.writer(), &name));
+                try!(self.popen());
+                try!(self.commasep(Consistent,
                               &items[..],
-                              |s, i| s.print_meta_item(&i))?;
-                self.pclose()?;
+                              |s, i| s.print_meta_item(&i)));
+                try!(self.pclose());
             }
         }
         self.end()
     }
 
     fn space_if_not_bol(&mut self) -> io::Result<()> {
-        if !self.is_bol() { space(self.writer())?; }
+        if !self.is_bol() { try!(space(self.writer())); }
         Ok(())
     }
 
@@ -821,24 +821,24 @@ impl<'a> State<'a> {
     }
 
     pub fn word_nbsp(&mut self, w: &str) -> io::Result<()> {
-        word(&mut self.s, w)?;
+        try!(word(&mut self.s, w));
         self.nbsp()
     }
 
     pub fn head(&mut self, w: &str) -> io::Result<()> {
         // outer-box is consistent
-        self.cbox(INDENT_UNIT)?;
+        try!(self.cbox(INDENT_UNIT));
         // head-box is inconsistent
-        self.ibox(w.len() + 1)?;
+        try!(self.ibox(w.len() + 1));
         // keyword that starts the head
         if !w.is_empty() {
-            self.word_nbsp(w)?;
+            try!(self.word_nbsp(w));
         }
         Ok(())
     }
 
     pub fn bopen(&mut self) -> io::Result<()> {
-        word(&mut self.s, "{")?;
+        try!(word(&mut self.s, "{"));
         self.end() // close the head-box
     }
 
@@ -848,11 +848,11 @@ impl<'a> State<'a> {
     }
     pub fn bclose_maybe_open(&mut self, span: codemap::Span,
                              indented: usize, close_box: bool) -> io::Result<()> {
-        self.maybe_print_comment(span.hi)?;
-        self.break_offset_if_not_bol(1, -(indented as isize))?;
-        word(&mut self.s, "}")?;
+        try!(self.maybe_print_comment(span.hi));
+        try!(self.break_offset_if_not_bol(1, -(indented as isize)));
+        try!(word(&mut self.s, "}"));
         if close_box {
-            self.end()?; // close the outer-box
+            try!(self.end()); // close the outer-box
         }
         Ok(())
     }
@@ -885,10 +885,10 @@ impl<'a> State<'a> {
     // Synthesizes a comment that was not textually present in the original source
     // file.
     pub fn synth_comment(&mut self, text: String) -> io::Result<()> {
-        word(&mut self.s, "/*")?;
-        space(&mut self.s)?;
-        word(&mut self.s, &text[..])?;
-        space(&mut self.s)?;
+        try!(word(&mut self.s, "/*"));
+        try!(space(&mut self.s));
+        try!(word(&mut self.s, &text[..]));
+        try!(space(&mut self.s));
         word(&mut self.s, "*/")
     }
 
@@ -902,18 +902,18 @@ impl<'a> State<'a> {
         F: FnMut(&mut State, &T) -> io::Result<()>,
         G: FnMut(&T) -> codemap::Span,
     {
-        self.rbox(0, b)?;
+        try!(self.rbox(0, b));
         let len = elts.len();
         let mut i = 0;
         for elt in elts {
-            self.maybe_print_comment(get_span(elt).hi)?;
-            op(self, elt)?;
+            try!(self.maybe_print_comment(get_span(elt).hi));
+            try!(op(self, elt));
             i += 1;
             if i < len {
-                word(&mut self.s, ",")?;
-                self.maybe_print_trailing_comment(get_span(elt),
-                                                  Some(get_span(&elts[i]).hi))?;
-                self.space_if_not_bol()?;
+                try!(word(&mut self.s, ","));
+                try!(self.maybe_print_trailing_comment(get_span(elt),
+                                                  Some(get_span(&elts[i]).hi)));
+                try!(self.space_if_not_bol());
             }
         }
         self.end()
@@ -926,18 +926,18 @@ impl<'a> State<'a> {
 
     pub fn print_mod(&mut self, _mod: &ast::Mod,
                      attrs: &[ast::Attribute]) -> io::Result<()> {
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
         for item in &_mod.items {
-            self.print_item(&item)?;
+            try!(self.print_item(&item));
         }
         Ok(())
     }
 
     pub fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod,
                              attrs: &[ast::Attribute]) -> io::Result<()> {
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
         for item in &nmod.items {
-            self.print_foreign_item(item)?;
+            try!(self.print_foreign_item(item));
         }
         Ok(())
     }
@@ -945,47 +945,47 @@ impl<'a> State<'a> {
     pub fn print_opt_lifetime(&mut self,
                               lifetime: &Option<ast::Lifetime>) -> io::Result<()> {
         if let Some(l) = *lifetime {
-            self.print_lifetime(&l)?;
-            self.nbsp()?;
+            try!(self.print_lifetime(&l));
+            try!(self.nbsp());
         }
         Ok(())
     }
 
     pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
-        self.maybe_print_comment(ty.span.lo)?;
-        self.ibox(0)?;
+        try!(self.maybe_print_comment(ty.span.lo));
+        try!(self.ibox(0));
         match ty.node {
             ast::TyKind::Vec(ref ty) => {
-                word(&mut self.s, "[")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, "]")?;
+                try!(word(&mut self.s, "["));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, "]"));
             }
             ast::TyKind::Ptr(ref mt) => {
-                word(&mut self.s, "*")?;
+                try!(word(&mut self.s, "*"));
                 match mt.mutbl {
-                    ast::Mutability::Mutable => self.word_nbsp("mut")?,
-                    ast::Mutability::Immutable => self.word_nbsp("const")?,
+                    ast::Mutability::Mutable => try!(self.word_nbsp("mut")),
+                    ast::Mutability::Immutable => try!(self.word_nbsp("const")),
                 }
-                self.print_type(&mt.ty)?;
+                try!(self.print_type(&mt.ty));
             }
             ast::TyKind::Rptr(ref lifetime, ref mt) => {
-                word(&mut self.s, "&")?;
-                self.print_opt_lifetime(lifetime)?;
-                self.print_mt(mt)?;
+                try!(word(&mut self.s, "&"));
+                try!(self.print_opt_lifetime(lifetime));
+                try!(self.print_mt(mt));
             }
             ast::TyKind::Tup(ref elts) => {
-                self.popen()?;
-                self.commasep(Inconsistent, &elts[..],
-                              |s, ty| s.print_type(&ty))?;
+                try!(self.popen());
+                try!(self.commasep(Inconsistent, &elts[..],
+                              |s, ty| s.print_type(&ty)));
                 if elts.len() == 1 {
-                    word(&mut self.s, ",")?;
+                    try!(word(&mut self.s, ","));
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             ast::TyKind::Paren(ref typ) => {
-                self.popen()?;
-                self.print_type(&typ)?;
-                self.pclose()?;
+                try!(self.popen());
+                try!(self.print_type(&typ));
+                try!(self.pclose());
             }
             ast::TyKind::BareFn(ref f) => {
                 let generics = ast::Generics {
@@ -996,45 +996,45 @@ impl<'a> State<'a> {
                         predicates: Vec::new(),
                     },
                 };
-                self.print_ty_fn(f.abi,
+                try!(self.print_ty_fn(f.abi,
                                  f.unsafety,
                                  &f.decl,
                                  None,
-                                 &generics)?;
+                                 &generics));
             }
             ast::TyKind::Path(None, ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
             }
             ast::TyKind::Path(Some(ref qself), ref path) => {
-                self.print_qpath(path, qself, false)?
+                try!(self.print_qpath(path, qself, false))
             }
             ast::TyKind::ObjectSum(ref ty, ref bounds) => {
-                self.print_type(&ty)?;
-                self.print_bounds("+", &bounds[..])?;
+                try!(self.print_type(&ty));
+                try!(self.print_bounds("+", &bounds[..]));
             }
             ast::TyKind::PolyTraitRef(ref bounds) => {
-                self.print_bounds("", &bounds[..])?;
+                try!(self.print_bounds("", &bounds[..]));
             }
             ast::TyKind::FixedLengthVec(ref ty, ref v) => {
-                word(&mut self.s, "[")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, "; ")?;
-                self.print_expr(&v)?;
-                word(&mut self.s, "]")?;
+                try!(word(&mut self.s, "["));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, "; "));
+                try!(self.print_expr(&v));
+                try!(word(&mut self.s, "]"));
             }
             ast::TyKind::Typeof(ref e) => {
-                word(&mut self.s, "typeof(")?;
-                self.print_expr(&e)?;
-                word(&mut self.s, ")")?;
+                try!(word(&mut self.s, "typeof("));
+                try!(self.print_expr(&e));
+                try!(word(&mut self.s, ")"));
             }
             ast::TyKind::Infer => {
-                word(&mut self.s, "_")?;
+                try!(word(&mut self.s, "_"));
             }
             ast::TyKind::ImplicitSelf => {
                 unreachable!();
             }
             ast::TyKind::Mac(ref m) => {
-                self.print_mac(m, token::Paren)?;
+                try!(self.print_mac(m, token::Paren));
             }
         }
         self.end()
@@ -1042,30 +1042,30 @@ impl<'a> State<'a> {
 
     pub fn print_foreign_item(&mut self,
                               item: &ast::ForeignItem) -> io::Result<()> {
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(item.span.lo)?;
-        self.print_outer_attributes(&item.attrs)?;
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(item.span.lo));
+        try!(self.print_outer_attributes(&item.attrs));
         match item.node {
             ast::ForeignItemKind::Fn(ref decl, ref generics) => {
-                self.head("")?;
-                self.print_fn(decl, ast::Unsafety::Normal,
+                try!(self.head(""));
+                try!(self.print_fn(decl, ast::Unsafety::Normal,
                               ast::Constness::NotConst,
                               Abi::Rust, Some(item.ident),
-                              generics, &item.vis)?;
-                self.end()?; // end head-ibox
-                word(&mut self.s, ";")?;
+                              generics, &item.vis));
+                try!(self.end()); // end head-ibox
+                try!(word(&mut self.s, ";"));
                 self.end() // end the outer fn box
             }
             ast::ForeignItemKind::Static(ref t, m) => {
-                self.head(&visibility_qualified(&item.vis, "static"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "static")));
                 if m {
-                    self.word_space("mut")?;
+                    try!(self.word_space("mut"));
                 }
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&t)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the head-ibox
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&t));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the head-ibox
                 self.end() // end the outer cbox
             }
         }
@@ -1078,15 +1078,15 @@ impl<'a> State<'a> {
                               vis: &ast::Visibility)
                               -> io::Result<()>
     {
-        word(&mut self.s, &visibility_qualified(vis, ""))?;
-        self.word_space("const")?;
-        self.print_ident(ident)?;
-        self.word_space(":")?;
-        self.print_type(ty)?;
+        try!(word(&mut self.s, &visibility_qualified(vis, "")));
+        try!(self.word_space("const"));
+        try!(self.print_ident(ident));
+        try!(self.word_space(":"));
+        try!(self.print_type(ty));
         if let Some(expr) = default {
-            space(&mut self.s)?;
-            self.word_space("=")?;
-            self.print_expr(expr)?;
+            try!(space(&mut self.s));
+            try!(self.word_space("="));
+            try!(self.print_expr(expr));
         }
         word(&mut self.s, ";")
     }
@@ -1096,83 +1096,83 @@ impl<'a> State<'a> {
                              bounds: Option<&ast::TyParamBounds>,
                              ty: Option<&ast::Ty>)
                              -> io::Result<()> {
-        self.word_space("type")?;
-        self.print_ident(ident)?;
+        try!(self.word_space("type"));
+        try!(self.print_ident(ident));
         if let Some(bounds) = bounds {
-            self.print_bounds(":", bounds)?;
+            try!(self.print_bounds(":", bounds));
         }
         if let Some(ty) = ty {
-            space(&mut self.s)?;
-            self.word_space("=")?;
-            self.print_type(ty)?;
+            try!(space(&mut self.s));
+            try!(self.word_space("="));
+            try!(self.print_type(ty));
         }
         word(&mut self.s, ";")
     }
 
     /// Pretty-print an item
     pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(item.span.lo)?;
-        self.print_outer_attributes(&item.attrs)?;
-        self.ann.pre(self, NodeItem(item))?;
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(item.span.lo));
+        try!(self.print_outer_attributes(&item.attrs));
+        try!(self.ann.pre(self, NodeItem(item)));
         match item.node {
             ast::ItemKind::ExternCrate(ref optional_path) => {
-                self.head(&visibility_qualified(&item.vis, "extern crate"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "extern crate")));
                 if let Some(p) = *optional_path {
                     let val = p.as_str();
                     if val.contains("-") {
-                        self.print_string(&val, ast::StrStyle::Cooked)?;
+                        try!(self.print_string(&val, ast::StrStyle::Cooked));
                     } else {
-                        self.print_name(p)?;
+                        try!(self.print_name(p));
                     }
-                    space(&mut self.s)?;
-                    word(&mut self.s, "as")?;
-                    space(&mut self.s)?;
+                    try!(space(&mut self.s));
+                    try!(word(&mut self.s, "as"));
+                    try!(space(&mut self.s));
                 }
-                self.print_ident(item.ident)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end inner head-block
-                self.end()?; // end outer head-block
+                try!(self.print_ident(item.ident));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end inner head-block
+                try!(self.end()); // end outer head-block
             }
             ast::ItemKind::Use(ref vp) => {
-                self.head(&visibility_qualified(&item.vis, "use"))?;
-                self.print_view_path(&vp)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end inner head-block
-                self.end()?; // end outer head-block
+                try!(self.head(&visibility_qualified(&item.vis, "use")));
+                try!(self.print_view_path(&vp));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end inner head-block
+                try!(self.end()); // end outer head-block
             }
             ast::ItemKind::Static(ref ty, m, ref expr) => {
-                self.head(&visibility_qualified(&item.vis, "static"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "static")));
                 if m == ast::Mutability::Mutable {
-                    self.word_space("mut")?;
+                    try!(self.word_space("mut"));
                 }
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
-                space(&mut self.s)?;
-                self.end()?; // end the head-ibox
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
+                try!(space(&mut self.s));
+                try!(self.end()); // end the head-ibox
 
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer cbox
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer cbox
             }
             ast::ItemKind::Const(ref ty, ref expr) => {
-                self.head(&visibility_qualified(&item.vis, "const"))?;
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
-                space(&mut self.s)?;
-                self.end()?; // end the head-ibox
+                try!(self.head(&visibility_qualified(&item.vis, "const")));
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
+                try!(space(&mut self.s));
+                try!(self.end()); // end the head-ibox
 
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer cbox
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer cbox
             }
             ast::ItemKind::Fn(ref decl, unsafety, constness, abi, ref typarams, ref body) => {
-                self.head("")?;
-                self.print_fn(
+                try!(self.head(""));
+                try!(self.print_fn(
                     decl,
                     unsafety,
                     constness,
@@ -1180,65 +1180,65 @@ impl<'a> State<'a> {
                     Some(item.ident),
                     typarams,
                     &item.vis
-                )?;
-                word(&mut self.s, " ")?;
-                self.print_block_with_attrs(&body, &item.attrs)?;
+                ));
+                try!(word(&mut self.s, " "));
+                try!(self.print_block_with_attrs(&body, &item.attrs));
             }
             ast::ItemKind::Mod(ref _mod) => {
-                self.head(&visibility_qualified(&item.vis, "mod"))?;
-                self.print_ident(item.ident)?;
-                self.nbsp()?;
-                self.bopen()?;
-                self.print_mod(_mod, &item.attrs)?;
-                self.bclose(item.span)?;
+                try!(self.head(&visibility_qualified(&item.vis, "mod")));
+                try!(self.print_ident(item.ident));
+                try!(self.nbsp());
+                try!(self.bopen());
+                try!(self.print_mod(_mod, &item.attrs));
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::ForeignMod(ref nmod) => {
-                self.head("extern")?;
-                self.word_nbsp(&nmod.abi.to_string())?;
-                self.bopen()?;
-                self.print_foreign_mod(nmod, &item.attrs)?;
-                self.bclose(item.span)?;
+                try!(self.head("extern"));
+                try!(self.word_nbsp(&nmod.abi.to_string()));
+                try!(self.bopen());
+                try!(self.print_foreign_mod(nmod, &item.attrs));
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Ty(ref ty, ref params) => {
-                self.ibox(INDENT_UNIT)?;
-                self.ibox(0)?;
-                self.word_nbsp(&visibility_qualified(&item.vis, "type"))?;
-                self.print_ident(item.ident)?;
-                self.print_generics(params)?;
-                self.end()?; // end the inner ibox
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.ibox(0));
+                try!(self.word_nbsp(&visibility_qualified(&item.vis, "type")));
+                try!(self.print_ident(item.ident));
+                try!(self.print_generics(params));
+                try!(self.end()); // end the inner ibox
 
-                self.print_where_clause(&params.where_clause)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer ibox
+                try!(self.print_where_clause(&params.where_clause));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer ibox
             }
             ast::ItemKind::Enum(ref enum_definition, ref params) => {
-                self.print_enum_def(
+                try!(self.print_enum_def(
                     enum_definition,
                     params,
                     item.ident,
                     item.span,
                     &item.vis
-                )?;
+                ));
             }
             ast::ItemKind::Struct(ref struct_def, ref generics) => {
-                self.head(&visibility_qualified(&item.vis, "struct"))?;
-                self.print_struct(&struct_def, generics, item.ident, item.span, true)?;
+                try!(self.head(&visibility_qualified(&item.vis, "struct")));
+                try!(self.print_struct(&struct_def, generics, item.ident, item.span, true));
             }
 
             ast::ItemKind::DefaultImpl(unsafety, ref trait_ref) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("impl")?;
-                self.print_trait_ref(trait_ref)?;
-                space(&mut self.s)?;
-                self.word_space("for")?;
-                self.word_space("..")?;
-                self.bopen()?;
-                self.bclose(item.span)?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("impl"));
+                try!(self.print_trait_ref(trait_ref));
+                try!(space(&mut self.s));
+                try!(self.word_space("for"));
+                try!(self.word_space(".."));
+                try!(self.bopen());
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Impl(unsafety,
                           polarity,
@@ -1246,80 +1246,80 @@ impl<'a> State<'a> {
                           ref opt_trait,
                           ref ty,
                           ref impl_items) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("impl")?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("impl"));
 
                 if generics.is_parameterized() {
-                    self.print_generics(generics)?;
-                    space(&mut self.s)?;
+                    try!(self.print_generics(generics));
+                    try!(space(&mut self.s));
                 }
 
                 match polarity {
                     ast::ImplPolarity::Negative => {
-                        word(&mut self.s, "!")?;
+                        try!(word(&mut self.s, "!"));
                     },
                     _ => {}
                 }
 
                 match *opt_trait {
                     Some(ref t) => {
-                        self.print_trait_ref(t)?;
-                        space(&mut self.s)?;
-                        self.word_space("for")?;
+                        try!(self.print_trait_ref(t));
+                        try!(space(&mut self.s));
+                        try!(self.word_space("for"));
                     }
                     None => {}
                 }
 
-                self.print_type(&ty)?;
-                self.print_where_clause(&generics.where_clause)?;
+                try!(self.print_type(&ty));
+                try!(self.print_where_clause(&generics.where_clause));
 
-                space(&mut self.s)?;
-                self.bopen()?;
-                self.print_inner_attributes(&item.attrs)?;
+                try!(space(&mut self.s));
+                try!(self.bopen());
+                try!(self.print_inner_attributes(&item.attrs));
                 for impl_item in impl_items {
-                    self.print_impl_item(impl_item)?;
+                    try!(self.print_impl_item(impl_item));
                 }
-                self.bclose(item.span)?;
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Trait(unsafety, ref generics, ref bounds, ref trait_items) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("trait")?;
-                self.print_ident(item.ident)?;
-                self.print_generics(generics)?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("trait"));
+                try!(self.print_ident(item.ident));
+                try!(self.print_generics(generics));
                 let mut real_bounds = Vec::with_capacity(bounds.len());
                 for b in bounds.iter() {
                     if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
-                        space(&mut self.s)?;
-                        self.word_space("for ?")?;
-                        self.print_trait_ref(&ptr.trait_ref)?;
+                        try!(space(&mut self.s));
+                        try!(self.word_space("for ?"));
+                        try!(self.print_trait_ref(&ptr.trait_ref));
                     } else {
                         real_bounds.push(b.clone());
                     }
                 }
-                self.print_bounds(":", &real_bounds[..])?;
-                self.print_where_clause(&generics.where_clause)?;
-                word(&mut self.s, " ")?;
-                self.bopen()?;
+                try!(self.print_bounds(":", &real_bounds[..]));
+                try!(self.print_where_clause(&generics.where_clause));
+                try!(word(&mut self.s, " "));
+                try!(self.bopen());
                 for trait_item in trait_items {
-                    self.print_trait_item(trait_item)?;
+                    try!(self.print_trait_item(trait_item));
                 }
-                self.bclose(item.span)?;
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Mac(codemap::Spanned { ref node, .. }) => {
-                self.print_visibility(&item.vis)?;
-                self.print_path(&node.path, false, 0)?;
-                word(&mut self.s, "! ")?;
-                self.print_ident(item.ident)?;
-                self.cbox(INDENT_UNIT)?;
-                self.popen()?;
-                self.print_tts(&node.tts[..])?;
-                self.pclose()?;
-                word(&mut self.s, ";")?;
-                self.end()?;
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_path(&node.path, false, 0));
+                try!(word(&mut self.s, "! "));
+                try!(self.print_ident(item.ident));
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.popen());
+                try!(self.print_tts(&node.tts[..]));
+                try!(self.pclose());
+                try!(word(&mut self.s, ";"));
+                try!(self.end());
             }
         }
         self.ann.post(self, NodeItem(item))
@@ -1331,22 +1331,22 @@ impl<'a> State<'a> {
 
     fn print_formal_lifetime_list(&mut self, lifetimes: &[ast::LifetimeDef]) -> io::Result<()> {
         if !lifetimes.is_empty() {
-            word(&mut self.s, "for<")?;
+            try!(word(&mut self.s, "for<"));
             let mut comma = false;
             for lifetime_def in lifetimes {
                 if comma {
-                    self.word_space(",")?
+                    try!(self.word_space(","))
                 }
-                self.print_lifetime_def(lifetime_def)?;
+                try!(self.print_lifetime_def(lifetime_def));
                 comma = true;
             }
-            word(&mut self.s, ">")?;
+            try!(word(&mut self.s, ">"));
         }
         Ok(())
     }
 
     fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) -> io::Result<()> {
-        self.print_formal_lifetime_list(&t.bound_lifetimes)?;
+        try!(self.print_formal_lifetime_list(&t.bound_lifetimes));
         self.print_trait_ref(&t.trait_ref)
     }
 
@@ -1354,27 +1354,27 @@ impl<'a> State<'a> {
                           generics: &ast::Generics, ident: ast::Ident,
                           span: codemap::Span,
                           visibility: &ast::Visibility) -> io::Result<()> {
-        self.head(&visibility_qualified(visibility, "enum"))?;
-        self.print_ident(ident)?;
-        self.print_generics(generics)?;
-        self.print_where_clause(&generics.where_clause)?;
-        space(&mut self.s)?;
+        try!(self.head(&visibility_qualified(visibility, "enum")));
+        try!(self.print_ident(ident));
+        try!(self.print_generics(generics));
+        try!(self.print_where_clause(&generics.where_clause));
+        try!(space(&mut self.s));
         self.print_variants(&enum_definition.variants, span)
     }
 
     pub fn print_variants(&mut self,
                           variants: &[ast::Variant],
                           span: codemap::Span) -> io::Result<()> {
-        self.bopen()?;
+        try!(self.bopen());
         for v in variants {
-            self.space_if_not_bol()?;
-            self.maybe_print_comment(v.span.lo)?;
-            self.print_outer_attributes(&v.node.attrs)?;
-            self.ibox(INDENT_UNIT)?;
-            self.print_variant(v)?;
-            word(&mut self.s, ",")?;
-            self.end()?;
-            self.maybe_print_trailing_comment(v.span, None)?;
+            try!(self.space_if_not_bol());
+            try!(self.maybe_print_comment(v.span.lo));
+            try!(self.print_outer_attributes(&v.node.attrs));
+            try!(self.ibox(INDENT_UNIT));
+            try!(self.print_variant(v));
+            try!(word(&mut self.s, ","));
+            try!(self.end());
+            try!(self.maybe_print_trailing_comment(v.span, None));
         }
         self.bclose(span)
     }
@@ -1395,42 +1395,42 @@ impl<'a> State<'a> {
                         ident: ast::Ident,
                         span: codemap::Span,
                         print_finalizer: bool) -> io::Result<()> {
-        self.print_ident(ident)?;
-        self.print_generics(generics)?;
+        try!(self.print_ident(ident));
+        try!(self.print_generics(generics));
         if !struct_def.is_struct() {
             if struct_def.is_tuple() {
-                self.popen()?;
-                self.commasep(
+                try!(self.popen());
+                try!(self.commasep(
                     Inconsistent, struct_def.fields(),
                     |s, field| {
-                        s.print_visibility(&field.vis)?;
-                        s.maybe_print_comment(field.span.lo)?;
+                        try!(s.print_visibility(&field.vis));
+                        try!(s.maybe_print_comment(field.span.lo));
                         s.print_type(&field.ty)
                     }
-                )?;
-                self.pclose()?;
+                ));
+                try!(self.pclose());
             }
-            self.print_where_clause(&generics.where_clause)?;
+            try!(self.print_where_clause(&generics.where_clause));
             if print_finalizer {
-                word(&mut self.s, ";")?;
+                try!(word(&mut self.s, ";"));
             }
-            self.end()?;
+            try!(self.end());
             self.end() // close the outer-box
         } else {
-            self.print_where_clause(&generics.where_clause)?;
-            self.nbsp()?;
-            self.bopen()?;
-            self.hardbreak_if_not_bol()?;
+            try!(self.print_where_clause(&generics.where_clause));
+            try!(self.nbsp());
+            try!(self.bopen());
+            try!(self.hardbreak_if_not_bol());
 
             for field in struct_def.fields() {
-                self.hardbreak_if_not_bol()?;
-                self.maybe_print_comment(field.span.lo)?;
-                self.print_outer_attributes(&field.attrs)?;
-                self.print_visibility(&field.vis)?;
-                self.print_ident(field.ident.unwrap())?;
-                self.word_nbsp(":")?;
-                self.print_type(&field.ty)?;
-                word(&mut self.s, ",")?;
+                try!(self.hardbreak_if_not_bol());
+                try!(self.maybe_print_comment(field.span.lo));
+                try!(self.print_outer_attributes(&field.attrs));
+                try!(self.print_visibility(&field.vis));
+                try!(self.print_ident(field.ident.unwrap()));
+                try!(self.word_nbsp(":"));
+                try!(self.print_type(&field.ty));
+                try!(word(&mut self.s, ","));
             }
 
             self.bclose(span)
@@ -1447,7 +1447,7 @@ impl<'a> State<'a> {
     pub fn print_tt(&mut self, tt: &ast::TokenTree) -> io::Result<()> {
         match *tt {
             TokenTree::Token(_, ref tk) => {
-                word(&mut self.s, &token_to_string(tk))?;
+                try!(word(&mut self.s, &token_to_string(tk)));
                 match *tk {
                     parse::token::DocComment(..) => {
                         hardbreak(&mut self.s)
@@ -1456,21 +1456,21 @@ impl<'a> State<'a> {
                 }
             }
             TokenTree::Delimited(_, ref delimed) => {
-                word(&mut self.s, &token_to_string(&delimed.open_token()))?;
-                space(&mut self.s)?;
-                self.print_tts(&delimed.tts)?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, &token_to_string(&delimed.open_token())));
+                try!(space(&mut self.s));
+                try!(self.print_tts(&delimed.tts));
+                try!(space(&mut self.s));
                 word(&mut self.s, &token_to_string(&delimed.close_token()))
             },
             TokenTree::Sequence(_, ref seq) => {
-                word(&mut self.s, "$(")?;
+                try!(word(&mut self.s, "$("));
                 for tt_elt in &seq.tts {
-                    self.print_tt(tt_elt)?;
+                    try!(self.print_tt(tt_elt));
                 }
-                word(&mut self.s, ")")?;
+                try!(word(&mut self.s, ")"));
                 match seq.separator {
                     Some(ref tk) => {
-                        word(&mut self.s, &token_to_string(tk))?;
+                        try!(word(&mut self.s, &token_to_string(tk)));
                     }
                     None => {},
                 }
@@ -1483,24 +1483,24 @@ impl<'a> State<'a> {
     }
 
     pub fn print_tts(&mut self, tts: &[ast::TokenTree]) -> io::Result<()> {
-        self.ibox(0)?;
+        try!(self.ibox(0));
         for (i, tt) in tts.iter().enumerate() {
             if i != 0 {
-                space(&mut self.s)?;
+                try!(space(&mut self.s));
             }
-            self.print_tt(tt)?;
+            try!(self.print_tt(tt));
         }
         self.end()
     }
 
     pub fn print_variant(&mut self, v: &ast::Variant) -> io::Result<()> {
-        self.head("")?;
+        try!(self.head(""));
         let generics = ast::Generics::default();
-        self.print_struct(&v.node.data, &generics, v.node.name, v.span, false)?;
+        try!(self.print_struct(&v.node.data, &generics, v.node.name, v.span, false));
         match v.node.disr_expr {
             Some(ref d) => {
-                space(&mut self.s)?;
-                self.word_space("=")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
                 self.print_expr(&d)
             }
             _ => Ok(())
@@ -1523,103 +1523,103 @@ impl<'a> State<'a> {
 
     pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
                             -> io::Result<()> {
-        self.ann.pre(self, NodeSubItem(ti.id))?;
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(ti.span.lo)?;
-        self.print_outer_attributes(&ti.attrs)?;
+        try!(self.ann.pre(self, NodeSubItem(ti.id)));
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(ti.span.lo));
+        try!(self.print_outer_attributes(&ti.attrs));
         match ti.node {
             ast::TraitItemKind::Const(ref ty, ref default) => {
-                self.print_associated_const(ti.ident, &ty,
+                try!(self.print_associated_const(ti.ident, &ty,
                                             default.as_ref().map(|expr| &**expr),
-                                            &ast::Visibility::Inherited)?;
+                                            &ast::Visibility::Inherited));
             }
             ast::TraitItemKind::Method(ref sig, ref body) => {
                 if body.is_some() {
-                    self.head("")?;
+                    try!(self.head(""));
                 }
-                self.print_method_sig(ti.ident, sig, &ast::Visibility::Inherited)?;
+                try!(self.print_method_sig(ti.ident, sig, &ast::Visibility::Inherited));
                 if let Some(ref body) = *body {
-                    self.nbsp()?;
-                    self.print_block_with_attrs(body, &ti.attrs)?;
+                    try!(self.nbsp());
+                    try!(self.print_block_with_attrs(body, &ti.attrs));
                 } else {
-                    word(&mut self.s, ";")?;
+                    try!(word(&mut self.s, ";"));
                 }
             }
             ast::TraitItemKind::Type(ref bounds, ref default) => {
-                self.print_associated_type(ti.ident, Some(bounds),
-                                           default.as_ref().map(|ty| &**ty))?;
+                try!(self.print_associated_type(ti.ident, Some(bounds),
+                                           default.as_ref().map(|ty| &**ty)));
             }
         }
         self.ann.post(self, NodeSubItem(ti.id))
     }
 
     pub fn print_impl_item(&mut self, ii: &ast::ImplItem) -> io::Result<()> {
-        self.ann.pre(self, NodeSubItem(ii.id))?;
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(ii.span.lo)?;
-        self.print_outer_attributes(&ii.attrs)?;
+        try!(self.ann.pre(self, NodeSubItem(ii.id)));
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(ii.span.lo));
+        try!(self.print_outer_attributes(&ii.attrs));
         if let ast::Defaultness::Default = ii.defaultness {
-            self.word_nbsp("default")?;
+            try!(self.word_nbsp("default"));
         }
         match ii.node {
             ast::ImplItemKind::Const(ref ty, ref expr) => {
-                self.print_associated_const(ii.ident, &ty, Some(&expr), &ii.vis)?;
+                try!(self.print_associated_const(ii.ident, &ty, Some(&expr), &ii.vis));
             }
             ast::ImplItemKind::Method(ref sig, ref body) => {
-                self.head("")?;
-                self.print_method_sig(ii.ident, sig, &ii.vis)?;
-                self.nbsp()?;
-                self.print_block_with_attrs(body, &ii.attrs)?;
+                try!(self.head(""));
+                try!(self.print_method_sig(ii.ident, sig, &ii.vis));
+                try!(self.nbsp());
+                try!(self.print_block_with_attrs(body, &ii.attrs));
             }
             ast::ImplItemKind::Type(ref ty) => {
-                self.print_associated_type(ii.ident, None, Some(ty))?;
+                try!(self.print_associated_type(ii.ident, None, Some(ty)));
             }
             ast::ImplItemKind::Macro(codemap::Spanned { ref node, .. }) => {
                 // code copied from ItemKind::Mac:
-                self.print_path(&node.path, false, 0)?;
-                word(&mut self.s, "! ")?;
-                self.cbox(INDENT_UNIT)?;
-                self.popen()?;
-                self.print_tts(&node.tts[..])?;
-                self.pclose()?;
-                word(&mut self.s, ";")?;
-                self.end()?
+                try!(self.print_path(&node.path, false, 0));
+                try!(word(&mut self.s, "! "));
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.popen());
+                try!(self.print_tts(&node.tts[..]));
+                try!(self.pclose());
+                try!(word(&mut self.s, ";"));
+                try!(self.end())
             }
         }
         self.ann.post(self, NodeSubItem(ii.id))
     }
 
     pub fn print_stmt(&mut self, st: &ast::Stmt) -> io::Result<()> {
-        self.maybe_print_comment(st.span.lo)?;
+        try!(self.maybe_print_comment(st.span.lo));
         match st.node {
             ast::StmtKind::Decl(ref decl, _) => {
-                self.print_decl(&decl)?;
+                try!(self.print_decl(&decl));
             }
             ast::StmtKind::Expr(ref expr, _) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
             }
             ast::StmtKind::Semi(ref expr, _) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
-                word(&mut self.s, ";")?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
+                try!(word(&mut self.s, ";"));
             }
             ast::StmtKind::Mac(ref mac, style, ref attrs) => {
-                self.space_if_not_bol()?;
-                self.print_outer_attributes(attrs.as_attr_slice())?;
+                try!(self.space_if_not_bol());
+                try!(self.print_outer_attributes(attrs.as_attr_slice()));
                 let delim = match style {
                     ast::MacStmtStyle::Braces => token::Brace,
                     _ => token::Paren
                 };
-                self.print_mac(&mac, delim)?;
+                try!(self.print_mac(&mac, delim));
                 match style {
                     ast::MacStmtStyle::Braces => {}
-                    _ => word(&mut self.s, ";")?,
+                    _ => try!(word(&mut self.s, ";")),
                 }
             }
         }
         if parse::classify::stmt_ends_with_semi(&st.node) {
-            word(&mut self.s, ";")?;
+            try!(word(&mut self.s, ";"));
         }
         self.maybe_print_trailing_comment(st.span, None)
     }
@@ -1655,27 +1655,27 @@ impl<'a> State<'a> {
                                       attrs: &[ast::Attribute],
                                       close_box: bool) -> io::Result<()> {
         match blk.rules {
-            BlockCheckMode::Unsafe(..) => self.word_space("unsafe")?,
+            BlockCheckMode::Unsafe(..) => try!(self.word_space("unsafe")),
             BlockCheckMode::Default => ()
         }
-        self.maybe_print_comment(blk.span.lo)?;
-        self.ann.pre(self, NodeBlock(blk))?;
-        self.bopen()?;
+        try!(self.maybe_print_comment(blk.span.lo));
+        try!(self.ann.pre(self, NodeBlock(blk)));
+        try!(self.bopen());
 
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
 
         for st in &blk.stmts {
-            self.print_stmt(st)?;
+            try!(self.print_stmt(st));
         }
         match blk.expr {
             Some(ref expr) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
-                self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi))?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
+                try!(self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi)));
             }
             _ => ()
         }
-        self.bclose_maybe_open(blk.span, indented, close_box)?;
+        try!(self.bclose_maybe_open(blk.span, indented, close_box));
         self.ann.post(self, NodeBlock(blk))
     }
 
@@ -1685,32 +1685,32 @@ impl<'a> State<'a> {
                 match _else.node {
                     // "another else-if"
                     ast::ExprKind::If(ref i, ref then, ref e) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else if ")?;
-                        self.print_expr(&i)?;
-                        space(&mut self.s)?;
-                        self.print_block(&then)?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else if "));
+                        try!(self.print_expr(&i));
+                        try!(space(&mut self.s));
+                        try!(self.print_block(&then));
                         self.print_else(e.as_ref().map(|e| &**e))
                     }
                     // "another else-if-let"
                     ast::ExprKind::IfLet(ref pat, ref expr, ref then, ref e) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else if let ")?;
-                        self.print_pat(&pat)?;
-                        space(&mut self.s)?;
-                        self.word_space("=")?;
-                        self.print_expr(&expr)?;
-                        space(&mut self.s)?;
-                        self.print_block(&then)?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else if let "));
+                        try!(self.print_pat(&pat));
+                        try!(space(&mut self.s));
+                        try!(self.word_space("="));
+                        try!(self.print_expr(&expr));
+                        try!(space(&mut self.s));
+                        try!(self.print_block(&then));
                         self.print_else(e.as_ref().map(|e| &**e))
                     }
                     // "final else"
                     ast::ExprKind::Block(ref b) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else ")?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else "));
                         self.print_block(&b)
                     }
                     // BLEAH, constraints would be great here
@@ -1725,38 +1725,38 @@ impl<'a> State<'a> {
 
     pub fn print_if(&mut self, test: &ast::Expr, blk: &ast::Block,
                     elseopt: Option<&ast::Expr>) -> io::Result<()> {
-        self.head("if")?;
-        self.print_expr(test)?;
-        space(&mut self.s)?;
-        self.print_block(blk)?;
+        try!(self.head("if"));
+        try!(self.print_expr(test));
+        try!(space(&mut self.s));
+        try!(self.print_block(blk));
         self.print_else(elseopt)
     }
 
     pub fn print_if_let(&mut self, pat: &ast::Pat, expr: &ast::Expr, blk: &ast::Block,
                         elseopt: Option<&ast::Expr>) -> io::Result<()> {
-        self.head("if let")?;
-        self.print_pat(pat)?;
-        space(&mut self.s)?;
-        self.word_space("=")?;
-        self.print_expr(expr)?;
-        space(&mut self.s)?;
-        self.print_block(blk)?;
+        try!(self.head("if let"));
+        try!(self.print_pat(pat));
+        try!(space(&mut self.s));
+        try!(self.word_space("="));
+        try!(self.print_expr(expr));
+        try!(space(&mut self.s));
+        try!(self.print_block(blk));
         self.print_else(elseopt)
     }
 
     pub fn print_mac(&mut self, m: &ast::Mac, delim: token::DelimToken)
                      -> io::Result<()> {
-        self.print_path(&m.node.path, false, 0)?;
-        word(&mut self.s, "!")?;
+        try!(self.print_path(&m.node.path, false, 0));
+        try!(word(&mut self.s, "!"));
         match delim {
-            token::Paren => self.popen()?,
-            token::Bracket => word(&mut self.s, "[")?,
+            token::Paren => try!(self.popen()),
+            token::Bracket => try!(word(&mut self.s, "[")),
             token::Brace => {
-                self.head("")?;
-                self.bopen()?;
+                try!(self.head(""));
+                try!(self.bopen());
             }
         }
-        self.print_tts(&m.node.tts)?;
+        try!(self.print_tts(&m.node.tts));
         match delim {
             token::Paren => self.pclose(),
             token::Bracket => word(&mut self.s, "]"),
@@ -1766,8 +1766,8 @@ impl<'a> State<'a> {
 
 
     fn print_call_post(&mut self, args: &[P<ast::Expr>]) -> io::Result<()> {
-        self.popen()?;
-        self.commasep_exprs(Inconsistent, args)?;
+        try!(self.popen());
+        try!(self.commasep_exprs(Inconsistent, args));
         self.pclose()
     }
 
@@ -1789,11 +1789,11 @@ impl<'a> State<'a> {
     pub fn print_expr_maybe_paren(&mut self, expr: &ast::Expr) -> io::Result<()> {
         let needs_par = needs_parentheses(expr);
         if needs_par {
-            self.popen()?;
+            try!(self.popen());
         }
-        self.print_expr(expr)?;
+        try!(self.print_expr(expr));
         if needs_par {
-            self.pclose()?;
+            try!(self.pclose());
         }
         Ok(())
     }
@@ -1801,19 +1801,19 @@ impl<'a> State<'a> {
     fn print_expr_in_place(&mut self,
                            place: &ast::Expr,
                            expr: &ast::Expr) -> io::Result<()> {
-        self.print_expr_maybe_paren(place)?;
-        space(&mut self.s)?;
-        self.word_space("<-")?;
+        try!(self.print_expr_maybe_paren(place));
+        try!(space(&mut self.s));
+        try!(self.word_space("<-"));
         self.print_expr_maybe_paren(expr)
     }
 
     fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>],
                       attrs: &[Attribute]) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
-        word(&mut self.s, "[")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_exprs(Inconsistent, &exprs[..])?;
-        word(&mut self.s, "]")?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(word(&mut self.s, "["));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_exprs(Inconsistent, &exprs[..]));
+        try!(word(&mut self.s, "]"));
         self.end()
     }
 
@@ -1821,13 +1821,13 @@ impl<'a> State<'a> {
                          element: &ast::Expr,
                          count: &ast::Expr,
                          attrs: &[Attribute]) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
-        word(&mut self.s, "[")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.print_expr(element)?;
-        self.word_space(";")?;
-        self.print_expr(count)?;
-        word(&mut self.s, "]")?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(word(&mut self.s, "["));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.print_expr(element));
+        try!(self.word_space(";"));
+        try!(self.print_expr(count));
+        try!(word(&mut self.s, "]"));
         self.end()
     }
 
@@ -1836,46 +1836,46 @@ impl<'a> State<'a> {
                          fields: &[ast::Field],
                          wth: &Option<P<ast::Expr>>,
                          attrs: &[Attribute]) -> io::Result<()> {
-        self.print_path(path, true, 0)?;
-        word(&mut self.s, "{")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_cmnt(
+        try!(self.print_path(path, true, 0));
+        try!(word(&mut self.s, "{"));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_cmnt(
             Consistent,
             &fields[..],
             |s, field| {
-                s.ibox(INDENT_UNIT)?;
-                s.print_ident(field.ident.node)?;
-                s.word_space(":")?;
-                s.print_expr(&field.expr)?;
+                try!(s.ibox(INDENT_UNIT));
+                try!(s.print_ident(field.ident.node));
+                try!(s.word_space(":"));
+                try!(s.print_expr(&field.expr));
                 s.end()
             },
-            |f| f.span)?;
+            |f| f.span));
         match *wth {
             Some(ref expr) => {
-                self.ibox(INDENT_UNIT)?;
+                try!(self.ibox(INDENT_UNIT));
                 if !fields.is_empty() {
-                    word(&mut self.s, ",")?;
-                    space(&mut self.s)?;
+                    try!(word(&mut self.s, ","));
+                    try!(space(&mut self.s));
                 }
-                word(&mut self.s, "..")?;
-                self.print_expr(&expr)?;
-                self.end()?;
+                try!(word(&mut self.s, ".."));
+                try!(self.print_expr(&expr));
+                try!(self.end());
             }
             _ => if !fields.is_empty() {
-                word(&mut self.s, ",")?
+                try!(word(&mut self.s, ","))
             }
         }
-        word(&mut self.s, "}")?;
+        try!(word(&mut self.s, "}"));
         Ok(())
     }
 
     fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>],
                       attrs: &[Attribute]) -> io::Result<()> {
-        self.popen()?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_exprs(Inconsistent, &exprs[..])?;
+        try!(self.popen());
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_exprs(Inconsistent, &exprs[..]));
         if exprs.len() == 1 {
-            word(&mut self.s, ",")?;
+            try!(word(&mut self.s, ","));
         }
         self.pclose()
     }
@@ -1883,7 +1883,7 @@ impl<'a> State<'a> {
     fn print_expr_call(&mut self,
                        func: &ast::Expr,
                        args: &[P<ast::Expr>]) -> io::Result<()> {
-        self.print_expr_maybe_paren(func)?;
+        try!(self.print_expr_maybe_paren(func));
         self.print_call_post(args)
     }
 
@@ -1892,14 +1892,14 @@ impl<'a> State<'a> {
                               tys: &[P<ast::Ty>],
                               args: &[P<ast::Expr>]) -> io::Result<()> {
         let base_args = &args[1..];
-        self.print_expr(&args[0])?;
-        word(&mut self.s, ".")?;
-        self.print_ident(ident.node)?;
+        try!(self.print_expr(&args[0]));
+        try!(word(&mut self.s, "."));
+        try!(self.print_ident(ident.node));
         if !tys.is_empty() {
-            word(&mut self.s, "::<")?;
-            self.commasep(Inconsistent, tys,
-                          |s, ty| s.print_type(&ty))?;
-            word(&mut self.s, ">")?;
+            try!(word(&mut self.s, "::<"));
+            try!(self.commasep(Inconsistent, tys,
+                          |s, ty| s.print_type(&ty)));
+            try!(word(&mut self.s, ">"));
         }
         self.print_call_post(base_args)
     }
@@ -1909,12 +1909,12 @@ impl<'a> State<'a> {
                          lhs: &ast::Expr,
                          rhs: &ast::Expr) -> io::Result<()> {
         if self.check_expr_bin_needs_paren(lhs, op) {
-            self.print_expr_maybe_paren(lhs)?;
+            try!(self.print_expr_maybe_paren(lhs));
         } else {
-            self.print_expr(lhs)?;
+            try!(self.print_expr(lhs));
         }
-        space(&mut self.s)?;
-        self.word_space(op.node.to_string())?;
+        try!(space(&mut self.s));
+        try!(self.word_space(op.node.to_string()));
         if self.check_expr_bin_needs_paren(rhs, op) {
             self.print_expr_maybe_paren(rhs)
         } else {
@@ -1925,15 +1925,15 @@ impl<'a> State<'a> {
     fn print_expr_unary(&mut self,
                         op: ast::UnOp,
                         expr: &ast::Expr) -> io::Result<()> {
-        word(&mut self.s, ast::UnOp::to_string(op))?;
+        try!(word(&mut self.s, ast::UnOp::to_string(op)));
         self.print_expr_maybe_paren(expr)
     }
 
     fn print_expr_addr_of(&mut self,
                           mutability: ast::Mutability,
                           expr: &ast::Expr) -> io::Result<()> {
-        word(&mut self.s, "&")?;
-        self.print_mutability(mutability)?;
+        try!(word(&mut self.s, "&"));
+        try!(self.print_mutability(mutability));
         self.print_expr_maybe_paren(expr)
     }
 
@@ -1944,139 +1944,139 @@ impl<'a> State<'a> {
     fn print_expr_outer_attr_style(&mut self,
                                   expr: &ast::Expr,
                                   is_inline: bool) -> io::Result<()> {
-        self.maybe_print_comment(expr.span.lo)?;
+        try!(self.maybe_print_comment(expr.span.lo));
 
         let attrs = expr.attrs.as_attr_slice();
         if is_inline {
-            self.print_outer_attributes_inline(attrs)?;
+            try!(self.print_outer_attributes_inline(attrs));
         } else {
-            self.print_outer_attributes(attrs)?;
+            try!(self.print_outer_attributes(attrs));
         }
 
-        self.ibox(INDENT_UNIT)?;
-        self.ann.pre(self, NodeExpr(expr))?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(self.ann.pre(self, NodeExpr(expr)));
         match expr.node {
             ast::ExprKind::Box(ref expr) => {
-                self.word_space("box")?;
-                self.print_expr(expr)?;
+                try!(self.word_space("box"));
+                try!(self.print_expr(expr));
             }
             ast::ExprKind::InPlace(ref place, ref expr) => {
-                self.print_expr_in_place(place, expr)?;
+                try!(self.print_expr_in_place(place, expr));
             }
             ast::ExprKind::Vec(ref exprs) => {
-                self.print_expr_vec(&exprs[..], attrs)?;
+                try!(self.print_expr_vec(&exprs[..], attrs));
             }
             ast::ExprKind::Repeat(ref element, ref count) => {
-                self.print_expr_repeat(&element, &count, attrs)?;
+                try!(self.print_expr_repeat(&element, &count, attrs));
             }
             ast::ExprKind::Struct(ref path, ref fields, ref wth) => {
-                self.print_expr_struct(path, &fields[..], wth, attrs)?;
+                try!(self.print_expr_struct(path, &fields[..], wth, attrs));
             }
             ast::ExprKind::Tup(ref exprs) => {
-                self.print_expr_tup(&exprs[..], attrs)?;
+                try!(self.print_expr_tup(&exprs[..], attrs));
             }
             ast::ExprKind::Call(ref func, ref args) => {
-                self.print_expr_call(&func, &args[..])?;
+                try!(self.print_expr_call(&func, &args[..]));
             }
             ast::ExprKind::MethodCall(ident, ref tys, ref args) => {
-                self.print_expr_method_call(ident, &tys[..], &args[..])?;
+                try!(self.print_expr_method_call(ident, &tys[..], &args[..]));
             }
             ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
-                self.print_expr_binary(op, &lhs, &rhs)?;
+                try!(self.print_expr_binary(op, &lhs, &rhs));
             }
             ast::ExprKind::Unary(op, ref expr) => {
-                self.print_expr_unary(op, &expr)?;
+                try!(self.print_expr_unary(op, &expr));
             }
             ast::ExprKind::AddrOf(m, ref expr) => {
-                self.print_expr_addr_of(m, &expr)?;
+                try!(self.print_expr_addr_of(m, &expr));
             }
             ast::ExprKind::Lit(ref lit) => {
-                self.print_literal(&lit)?;
+                try!(self.print_literal(&lit));
             }
             ast::ExprKind::Cast(ref expr, ref ty) => {
                 if let ast::ExprKind::Cast(..) = expr.node {
-                    self.print_expr(&expr)?;
+                    try!(self.print_expr(&expr));
                 } else {
-                    self.print_expr_maybe_paren(&expr)?;
+                    try!(self.print_expr_maybe_paren(&expr));
                 }
-                space(&mut self.s)?;
-                self.word_space("as")?;
-                self.print_type(&ty)?;
+                try!(space(&mut self.s));
+                try!(self.word_space("as"));
+                try!(self.print_type(&ty));
             }
             ast::ExprKind::Type(ref expr, ref ty) => {
-                self.print_expr(&expr)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
+                try!(self.print_expr(&expr));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
             }
             ast::ExprKind::If(ref test, ref blk, ref elseopt) => {
-                self.print_if(&test, &blk, elseopt.as_ref().map(|e| &**e))?;
+                try!(self.print_if(&test, &blk, elseopt.as_ref().map(|e| &**e)));
             }
             ast::ExprKind::IfLet(ref pat, ref expr, ref blk, ref elseopt) => {
-                self.print_if_let(&pat, &expr, &blk, elseopt.as_ref().map(|e| &**e))?;
+                try!(self.print_if_let(&pat, &expr, &blk, elseopt.as_ref().map(|e| &**e)));
             }
             ast::ExprKind::While(ref test, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("while")?;
-                self.print_expr(&test)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("while"));
+                try!(self.print_expr(&test));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::WhileLet(ref pat, ref expr, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("while let")?;
-                self.print_pat(&pat)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("while let"));
+                try!(self.print_pat(&pat));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::ForLoop(ref pat, ref iter, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("for")?;
-                self.print_pat(&pat)?;
-                space(&mut self.s)?;
-                self.word_space("in")?;
-                self.print_expr(&iter)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("for"));
+                try!(self.print_pat(&pat));
+                try!(space(&mut self.s));
+                try!(self.word_space("in"));
+                try!(self.print_expr(&iter));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Loop(ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("loop")?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("loop"));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Match(ref expr, ref arms) => {
-                self.cbox(INDENT_UNIT)?;
-                self.ibox(4)?;
-                self.word_nbsp("match")?;
-                self.print_expr(&expr)?;
-                space(&mut self.s)?;
-                self.bopen()?;
-                self.print_inner_attributes_no_trailing_hardbreak(attrs)?;
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.ibox(4));
+                try!(self.word_nbsp("match"));
+                try!(self.print_expr(&expr));
+                try!(space(&mut self.s));
+                try!(self.bopen());
+                try!(self.print_inner_attributes_no_trailing_hardbreak(attrs));
                 for arm in arms {
-                    self.print_arm(arm)?;
+                    try!(self.print_arm(arm));
                 }
-                self.bclose_(expr.span, INDENT_UNIT)?;
+                try!(self.bclose_(expr.span, INDENT_UNIT));
             }
             ast::ExprKind::Closure(capture_clause, ref decl, ref body, _) => {
-                self.print_capture_clause(capture_clause)?;
+                try!(self.print_capture_clause(capture_clause));
 
-                self.print_fn_block_args(&decl)?;
-                space(&mut self.s)?;
+                try!(self.print_fn_block_args(&decl));
+                try!(space(&mut self.s));
 
                 let default_return = match decl.output {
                     ast::FunctionRetTy::Default(..) => true,
@@ -2084,150 +2084,150 @@ impl<'a> State<'a> {
                 };
 
                 if !default_return || !body.stmts.is_empty() || body.expr.is_none() {
-                    self.print_block_unclosed(&body)?;
+                    try!(self.print_block_unclosed(&body));
                 } else {
                     // we extract the block, so as not to create another set of boxes
                     let i_expr = body.expr.as_ref().unwrap();
                     match i_expr.node {
                         ast::ExprKind::Block(ref blk) => {
-                            self.print_block_unclosed_with_attrs(
+                            try!(self.print_block_unclosed_with_attrs(
                                 &blk,
-                                i_expr.attrs.as_attr_slice())?;
+                                i_expr.attrs.as_attr_slice()));
                         }
                         _ => {
                             // this is a bare expression
-                            self.print_expr(&i_expr)?;
-                            self.end()?; // need to close a box
+                            try!(self.print_expr(&i_expr));
+                            try!(self.end()); // need to close a box
                         }
                     }
                 }
                 // a box will be closed by print_expr, but we didn't want an overall
                 // wrapper so we closed the corresponding opening. so create an
                 // empty box to satisfy the close.
-                self.ibox(0)?;
+                try!(self.ibox(0));
             }
             ast::ExprKind::Block(ref blk) => {
                 // containing cbox, will be closed by print-block at }
-                self.cbox(INDENT_UNIT)?;
+                try!(self.cbox(INDENT_UNIT));
                 // head-box, will be closed by print-block after {
-                self.ibox(0)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.ibox(0));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Assign(ref lhs, ref rhs) => {
-                self.print_expr(&lhs)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_expr(&rhs)?;
+                try!(self.print_expr(&lhs));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_expr(&rhs));
             }
             ast::ExprKind::AssignOp(op, ref lhs, ref rhs) => {
-                self.print_expr(&lhs)?;
-                space(&mut self.s)?;
-                word(&mut self.s, op.node.to_string())?;
-                self.word_space("=")?;
-                self.print_expr(&rhs)?;
+                try!(self.print_expr(&lhs));
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, op.node.to_string()));
+                try!(self.word_space("="));
+                try!(self.print_expr(&rhs));
             }
             ast::ExprKind::Field(ref expr, id) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, ".")?;
-                self.print_ident(id.node)?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "."));
+                try!(self.print_ident(id.node));
             }
             ast::ExprKind::TupField(ref expr, id) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, ".")?;
-                self.print_usize(id.node)?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "."));
+                try!(self.print_usize(id.node));
             }
             ast::ExprKind::Index(ref expr, ref index) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, "[")?;
-                self.print_expr(&index)?;
-                word(&mut self.s, "]")?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "["));
+                try!(self.print_expr(&index));
+                try!(word(&mut self.s, "]"));
             }
             ast::ExprKind::Range(ref start, ref end, limits) => {
                 if let &Some(ref e) = start {
-                    self.print_expr(&e)?;
+                    try!(self.print_expr(&e));
                 }
                 if limits == ast::RangeLimits::HalfOpen {
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                 } else {
-                    word(&mut self.s, "...")?;
+                    try!(word(&mut self.s, "..."));
                 }
                 if let &Some(ref e) = end {
-                    self.print_expr(&e)?;
+                    try!(self.print_expr(&e));
                 }
             }
             ast::ExprKind::Path(None, ref path) => {
-                self.print_path(path, true, 0)?
+                try!(self.print_path(path, true, 0))
             }
             ast::ExprKind::Path(Some(ref qself), ref path) => {
-                self.print_qpath(path, qself, true)?
+                try!(self.print_qpath(path, qself, true))
             }
             ast::ExprKind::Break(opt_ident) => {
-                word(&mut self.s, "break")?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, "break"));
+                try!(space(&mut self.s));
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    space(&mut self.s)?;
+                    try!(self.print_ident(ident.node));
+                    try!(space(&mut self.s));
                 }
             }
             ast::ExprKind::Again(opt_ident) => {
-                word(&mut self.s, "continue")?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, "continue"));
+                try!(space(&mut self.s));
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    space(&mut self.s)?
+                    try!(self.print_ident(ident.node));
+                    try!(space(&mut self.s))
                 }
             }
             ast::ExprKind::Ret(ref result) => {
-                word(&mut self.s, "return")?;
+                try!(word(&mut self.s, "return"));
                 match *result {
                     Some(ref expr) => {
-                        word(&mut self.s, " ")?;
-                        self.print_expr(&expr)?;
+                        try!(word(&mut self.s, " "));
+                        try!(self.print_expr(&expr));
                     }
                     _ => ()
                 }
             }
             ast::ExprKind::InlineAsm(ref a) => {
-                word(&mut self.s, "asm!")?;
-                self.popen()?;
-                self.print_string(&a.asm, a.asm_str_style)?;
-                self.word_space(":")?;
+                try!(word(&mut self.s, "asm!"));
+                try!(self.popen());
+                try!(self.print_string(&a.asm, a.asm_str_style));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.outputs,
+                try!(self.commasep(Inconsistent, &a.outputs,
                                    |s, out| {
                     let mut ch = out.constraint.chars();
                     match ch.next() {
                         Some('=') if out.is_rw => {
-                            s.print_string(&format!("+{}", ch.as_str()),
-                                           ast::StrStyle::Cooked)?
+                            try!(s.print_string(&format!("+{}", ch.as_str()),
+                                           ast::StrStyle::Cooked))
                         }
-                        _ => s.print_string(&out.constraint,
-                                            ast::StrStyle::Cooked)?
+                        _ => try!(s.print_string(&out.constraint,
+                                            ast::StrStyle::Cooked))
                     }
-                    s.popen()?;
-                    s.print_expr(&out.expr)?;
-                    s.pclose()?;
+                    try!(s.popen());
+                    try!(s.print_expr(&out.expr));
+                    try!(s.pclose());
                     Ok(())
-                })?;
-                space(&mut self.s)?;
-                self.word_space(":")?;
+                }));
+                try!(space(&mut self.s));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.inputs,
+                try!(self.commasep(Inconsistent, &a.inputs,
                                    |s, &(ref co, ref o)| {
-                    s.print_string(&co, ast::StrStyle::Cooked)?;
-                    s.popen()?;
-                    s.print_expr(&o)?;
-                    s.pclose()?;
+                    try!(s.print_string(&co, ast::StrStyle::Cooked));
+                    try!(s.popen());
+                    try!(s.print_expr(&o));
+                    try!(s.pclose());
                     Ok(())
-                })?;
-                space(&mut self.s)?;
-                self.word_space(":")?;
+                }));
+                try!(space(&mut self.s));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.clobbers,
+                try!(self.commasep(Inconsistent, &a.clobbers,
                                    |s, co| {
-                    s.print_string(&co, ast::StrStyle::Cooked)?;
+                    try!(s.print_string(&co, ast::StrStyle::Cooked));
                     Ok(())
-                })?;
+                }));
 
                 let mut options = vec!();
                 if a.volatile {
@@ -2241,58 +2241,58 @@ impl<'a> State<'a> {
                 }
 
                 if !options.is_empty() {
-                    space(&mut self.s)?;
-                    self.word_space(":")?;
-                    self.commasep(Inconsistent, &options,
+                    try!(space(&mut self.s));
+                    try!(self.word_space(":"));
+                    try!(self.commasep(Inconsistent, &options,
                                   |s, &co| {
-                                      s.print_string(co, ast::StrStyle::Cooked)?;
+                                      try!(s.print_string(co, ast::StrStyle::Cooked));
                                       Ok(())
-                                  })?;
+                                  }));
                 }
 
-                self.pclose()?;
+                try!(self.pclose());
             }
-            ast::ExprKind::Mac(ref m) => self.print_mac(m, token::Paren)?,
+            ast::ExprKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)),
             ast::ExprKind::Paren(ref e) => {
-                self.popen()?;
-                self.print_inner_attributes_inline(attrs)?;
-                self.print_expr(&e)?;
-                self.pclose()?;
+                try!(self.popen());
+                try!(self.print_inner_attributes_inline(attrs));
+                try!(self.print_expr(&e));
+                try!(self.pclose());
             },
             ast::ExprKind::Try(ref e) => {
-                self.print_expr(e)?;
-                word(&mut self.s, "?")?
+                try!(self.print_expr(e));
+                try!(word(&mut self.s, "?"))
             }
         }
-        self.ann.post(self, NodeExpr(expr))?;
+        try!(self.ann.post(self, NodeExpr(expr)));
         self.end()
     }
 
     pub fn print_local_decl(&mut self, loc: &ast::Local) -> io::Result<()> {
-        self.print_pat(&loc.pat)?;
+        try!(self.print_pat(&loc.pat));
         if let Some(ref ty) = loc.ty {
-            self.word_space(":")?;
-            self.print_type(&ty)?;
+            try!(self.word_space(":"));
+            try!(self.print_type(&ty));
         }
         Ok(())
     }
 
     pub fn print_decl(&mut self, decl: &ast::Decl) -> io::Result<()> {
-        self.maybe_print_comment(decl.span.lo)?;
+        try!(self.maybe_print_comment(decl.span.lo));
         match decl.node {
             ast::DeclKind::Local(ref loc) => {
-                self.print_outer_attributes(loc.attrs.as_attr_slice())?;
-                self.space_if_not_bol()?;
-                self.ibox(INDENT_UNIT)?;
-                self.word_nbsp("let")?;
+                try!(self.print_outer_attributes(loc.attrs.as_attr_slice()));
+                try!(self.space_if_not_bol());
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.word_nbsp("let"));
 
-                self.ibox(INDENT_UNIT)?;
-                self.print_local_decl(&loc)?;
-                self.end()?;
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.print_local_decl(&loc));
+                try!(self.end());
                 if let Some(ref init) = loc.init {
-                    self.nbsp()?;
-                    self.word_space("=")?;
-                    self.print_expr(&init)?;
+                    try!(self.nbsp());
+                    try!(self.word_space("="));
+                    try!(self.print_expr(&init));
                 }
                 self.end()
             }
@@ -2301,7 +2301,7 @@ impl<'a> State<'a> {
     }
 
     pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> {
-        word(&mut self.s, &ident.name.as_str())?;
+        try!(word(&mut self.s, &ident.name.as_str()));
         self.ann.post(self, NodeIdent(&ident))
     }
 
@@ -2310,15 +2310,15 @@ impl<'a> State<'a> {
     }
 
     pub fn print_name(&mut self, name: ast::Name) -> io::Result<()> {
-        word(&mut self.s, &name.as_str())?;
+        try!(word(&mut self.s, &name.as_str()));
         self.ann.post(self, NodeName(&name))
     }
 
     pub fn print_for_decl(&mut self, loc: &ast::Local,
                           coll: &ast::Expr) -> io::Result<()> {
-        self.print_local_decl(loc)?;
-        space(&mut self.s)?;
-        self.word_space("in")?;
+        try!(self.print_local_decl(loc));
+        try!(space(&mut self.s));
+        try!(self.word_space("in"));
         self.print_expr(coll)
     }
 
@@ -2328,19 +2328,19 @@ impl<'a> State<'a> {
                   depth: usize)
                   -> io::Result<()>
     {
-        self.maybe_print_comment(path.span.lo)?;
+        try!(self.maybe_print_comment(path.span.lo));
 
         let mut first = !path.global;
         for segment in &path.segments[..path.segments.len()-depth] {
             if first {
                 first = false
             } else {
-                word(&mut self.s, "::")?
+                try!(word(&mut self.s, "::"))
             }
 
-            self.print_ident(segment.identifier)?;
+            try!(self.print_ident(segment.identifier));
 
-            self.print_path_parameters(&segment.parameters, colons_before_params)?;
+            try!(self.print_path_parameters(&segment.parameters, colons_before_params));
         }
 
         Ok(())
@@ -2352,18 +2352,18 @@ impl<'a> State<'a> {
                    colons_before_params: bool)
                    -> io::Result<()>
     {
-        word(&mut self.s, "<")?;
-        self.print_type(&qself.ty)?;
+        try!(word(&mut self.s, "<"));
+        try!(self.print_type(&qself.ty));
         if qself.position > 0 {
-            space(&mut self.s)?;
-            self.word_space("as")?;
+            try!(space(&mut self.s));
+            try!(self.word_space("as"));
             let depth = path.segments.len() - qself.position;
-            self.print_path(&path, false, depth)?;
+            try!(self.print_path(&path, false, depth));
         }
-        word(&mut self.s, ">")?;
-        word(&mut self.s, "::")?;
+        try!(word(&mut self.s, ">"));
+        try!(word(&mut self.s, "::"));
         let item_segment = path.segments.last().unwrap();
-        self.print_ident(item_segment.identifier)?;
+        try!(self.print_ident(item_segment.identifier));
         self.print_path_parameters(&item_segment.parameters, colons_before_params)
     }
 
@@ -2377,61 +2377,61 @@ impl<'a> State<'a> {
         }
 
         if colons_before_params {
-            word(&mut self.s, "::")?
+            try!(word(&mut self.s, "::"))
         }
 
         match *parameters {
             ast::PathParameters::AngleBracketed(ref data) => {
-                word(&mut self.s, "<")?;
+                try!(word(&mut self.s, "<"));
 
                 let mut comma = false;
                 for lifetime in &data.lifetimes {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.print_lifetime(lifetime)?;
+                    try!(self.print_lifetime(lifetime));
                     comma = true;
                 }
 
                 if !data.types.is_empty() {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.commasep(
+                    try!(self.commasep(
                         Inconsistent,
                         &data.types,
-                        |s, ty| s.print_type(&ty))?;
+                        |s, ty| s.print_type(&ty)));
                         comma = true;
                 }
 
                 for binding in data.bindings.iter() {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.print_ident(binding.ident)?;
-                    space(&mut self.s)?;
-                    self.word_space("=")?;
-                    self.print_type(&binding.ty)?;
+                    try!(self.print_ident(binding.ident));
+                    try!(space(&mut self.s));
+                    try!(self.word_space("="));
+                    try!(self.print_type(&binding.ty));
                     comma = true;
                 }
 
-                word(&mut self.s, ">")?
+                try!(word(&mut self.s, ">"))
             }
 
             ast::PathParameters::Parenthesized(ref data) => {
-                word(&mut self.s, "(")?;
-                self.commasep(
+                try!(word(&mut self.s, "("));
+                try!(self.commasep(
                     Inconsistent,
                     &data.inputs,
-                    |s, ty| s.print_type(&ty))?;
-                word(&mut self.s, ")")?;
+                    |s, ty| s.print_type(&ty)));
+                try!(word(&mut self.s, ")"));
 
                 match data.output {
                     None => { }
                     Some(ref ty) => {
-                        self.space_if_not_bol()?;
-                        self.word_space("->")?;
-                        self.print_type(&ty)?;
+                        try!(self.space_if_not_bol());
+                        try!(self.word_space("->"));
+                        try!(self.print_type(&ty));
                     }
                 }
             }
@@ -2441,133 +2441,133 @@ impl<'a> State<'a> {
     }
 
     pub fn print_pat(&mut self, pat: &ast::Pat) -> io::Result<()> {
-        self.maybe_print_comment(pat.span.lo)?;
-        self.ann.pre(self, NodePat(pat))?;
+        try!(self.maybe_print_comment(pat.span.lo));
+        try!(self.ann.pre(self, NodePat(pat)));
         /* Pat isn't normalized, but the beauty of it
          is that it doesn't matter */
         match pat.node {
-            PatKind::Wild => word(&mut self.s, "_")?,
+            PatKind::Wild => try!(word(&mut self.s, "_")),
             PatKind::Ident(binding_mode, ref path1, ref sub) => {
                 match binding_mode {
                     ast::BindingMode::ByRef(mutbl) => {
-                        self.word_nbsp("ref")?;
-                        self.print_mutability(mutbl)?;
+                        try!(self.word_nbsp("ref"));
+                        try!(self.print_mutability(mutbl));
                     }
                     ast::BindingMode::ByValue(ast::Mutability::Immutable) => {}
                     ast::BindingMode::ByValue(ast::Mutability::Mutable) => {
-                        self.word_nbsp("mut")?;
+                        try!(self.word_nbsp("mut"));
                     }
                 }
-                self.print_ident(path1.node)?;
+                try!(self.print_ident(path1.node));
                 if let Some(ref p) = *sub {
-                    word(&mut self.s, "@")?;
-                    self.print_pat(&p)?;
+                    try!(word(&mut self.s, "@"));
+                    try!(self.print_pat(&p));
                 }
             }
             PatKind::TupleStruct(ref path, ref elts, ddpos) => {
-                self.print_path(path, true, 0)?;
-                self.popen()?;
+                try!(self.print_path(path, true, 0));
+                try!(self.popen());
                 if let Some(ddpos) = ddpos {
-                    self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p)));
                     if ddpos != 0 {
-                        self.word_space(",")?;
+                        try!(self.word_space(","));
                     }
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                     if ddpos != elts.len() {
-                        word(&mut self.s, ",")?;
-                        self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
+                        try!(word(&mut self.s, ","));
+                        try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p)));
                     }
                 } else {
-                    self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             PatKind::Path(ref path) => {
-                self.print_path(path, true, 0)?;
+                try!(self.print_path(path, true, 0));
             }
             PatKind::QPath(ref qself, ref path) => {
-                self.print_qpath(path, qself, false)?;
+                try!(self.print_qpath(path, qself, false));
             }
             PatKind::Struct(ref path, ref fields, etc) => {
-                self.print_path(path, true, 0)?;
-                self.nbsp()?;
-                self.word_space("{")?;
-                self.commasep_cmnt(
+                try!(self.print_path(path, true, 0));
+                try!(self.nbsp());
+                try!(self.word_space("{"));
+                try!(self.commasep_cmnt(
                     Consistent, &fields[..],
                     |s, f| {
-                        s.cbox(INDENT_UNIT)?;
+                        try!(s.cbox(INDENT_UNIT));
                         if !f.node.is_shorthand {
-                            s.print_ident(f.node.ident)?;
-                            s.word_nbsp(":")?;
+                            try!(s.print_ident(f.node.ident));
+                            try!(s.word_nbsp(":"));
                         }
-                        s.print_pat(&f.node.pat)?;
+                        try!(s.print_pat(&f.node.pat));
                         s.end()
                     },
-                    |f| f.node.pat.span)?;
+                    |f| f.node.pat.span));
                 if etc {
-                    if !fields.is_empty() { self.word_space(",")?; }
-                    word(&mut self.s, "..")?;
+                    if !fields.is_empty() { try!(self.word_space(",")); }
+                    try!(word(&mut self.s, ".."));
                 }
-                space(&mut self.s)?;
-                word(&mut self.s, "}")?;
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, "}"));
             }
             PatKind::Tuple(ref elts, ddpos) => {
-                self.popen()?;
+                try!(self.popen());
                 if let Some(ddpos) = ddpos {
-                    self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p)));
                     if ddpos != 0 {
-                        self.word_space(",")?;
+                        try!(self.word_space(","));
                     }
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                     if ddpos != elts.len() {
-                        word(&mut self.s, ",")?;
-                        self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
+                        try!(word(&mut self.s, ","));
+                        try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p)));
                     }
                 } else {
-                    self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
                     if elts.len() == 1 {
-                        word(&mut self.s, ",")?;
+                        try!(word(&mut self.s, ","));
                     }
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             PatKind::Box(ref inner) => {
-                word(&mut self.s, "box ")?;
-                self.print_pat(&inner)?;
+                try!(word(&mut self.s, "box "));
+                try!(self.print_pat(&inner));
             }
             PatKind::Ref(ref inner, mutbl) => {
-                word(&mut self.s, "&")?;
+                try!(word(&mut self.s, "&"));
                 if mutbl == ast::Mutability::Mutable {
-                    word(&mut self.s, "mut ")?;
+                    try!(word(&mut self.s, "mut "));
                 }
-                self.print_pat(&inner)?;
+                try!(self.print_pat(&inner));
             }
-            PatKind::Lit(ref e) => self.print_expr(&**e)?,
+            PatKind::Lit(ref e) => try!(self.print_expr(&**e)),
             PatKind::Range(ref begin, ref end) => {
-                self.print_expr(&begin)?;
-                space(&mut self.s)?;
-                word(&mut self.s, "...")?;
-                self.print_expr(&end)?;
+                try!(self.print_expr(&begin));
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, "..."));
+                try!(self.print_expr(&end));
             }
             PatKind::Vec(ref before, ref slice, ref after) => {
-                word(&mut self.s, "[")?;
-                self.commasep(Inconsistent,
+                try!(word(&mut self.s, "["));
+                try!(self.commasep(Inconsistent,
                                    &before[..],
-                                   |s, p| s.print_pat(&p))?;
+                                   |s, p| s.print_pat(&p)));
                 if let Some(ref p) = *slice {
-                    if !before.is_empty() { self.word_space(",")?; }
+                    if !before.is_empty() { try!(self.word_space(",")); }
                     if p.node != PatKind::Wild {
-                        self.print_pat(&p)?;
+                        try!(self.print_pat(&p));
                     }
-                    word(&mut self.s, "..")?;
-                    if !after.is_empty() { self.word_space(",")?; }
+                    try!(word(&mut self.s, ".."));
+                    if !after.is_empty() { try!(self.word_space(",")); }
                 }
-                self.commasep(Inconsistent,
+                try!(self.commasep(Inconsistent,
                                    &after[..],
-                                   |s, p| s.print_pat(&p))?;
-                word(&mut self.s, "]")?;
+                                   |s, p| s.print_pat(&p)));
+                try!(word(&mut self.s, "]"));
             }
-            PatKind::Mac(ref m) => self.print_mac(m, token::Paren)?,
+            PatKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)),
         }
         self.ann.post(self, NodePat(pat))
     }
@@ -2576,43 +2576,43 @@ impl<'a> State<'a> {
         // I have no idea why this check is necessary, but here it
         // is :(
         if arm.attrs.is_empty() {
-            space(&mut self.s)?;
+            try!(space(&mut self.s));
         }
-        self.cbox(INDENT_UNIT)?;
-        self.ibox(0)?;
-        self.print_outer_attributes(&arm.attrs)?;
+        try!(self.cbox(INDENT_UNIT));
+        try!(self.ibox(0));
+        try!(self.print_outer_attributes(&arm.attrs));
         let mut first = true;
         for p in &arm.pats {
             if first {
                 first = false;
             } else {
-                space(&mut self.s)?;
-                self.word_space("|")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("|"));
             }
-            self.print_pat(&p)?;
+            try!(self.print_pat(&p));
         }
-        space(&mut self.s)?;
+        try!(space(&mut self.s));
         if let Some(ref e) = arm.guard {
-            self.word_space("if")?;
-            self.print_expr(&e)?;
-            space(&mut self.s)?;
+            try!(self.word_space("if"));
+            try!(self.print_expr(&e));
+            try!(space(&mut self.s));
         }
-        self.word_space("=>")?;
+        try!(self.word_space("=>"));
 
         match arm.body.node {
             ast::ExprKind::Block(ref blk) => {
                 // the block will close the pattern's ibox
-                self.print_block_unclosed_indent(&blk, INDENT_UNIT)?;
+                try!(self.print_block_unclosed_indent(&blk, INDENT_UNIT));
 
                 // If it is a user-provided unsafe block, print a comma after it
                 if let BlockCheckMode::Unsafe(ast::UserProvided) = blk.rules {
-                    word(&mut self.s, ",")?;
+                    try!(word(&mut self.s, ","));
                 }
             }
             _ => {
-                self.end()?; // close the ibox for the pattern
-                self.print_expr(&arm.body)?;
-                word(&mut self.s, ",")?;
+                try!(self.end()); // close the ibox for the pattern
+                try!(self.print_expr(&arm.body));
+                try!(word(&mut self.s, ","));
             }
         }
         self.end() // close enclosing cbox
@@ -2621,19 +2621,19 @@ impl<'a> State<'a> {
     fn print_explicit_self(&mut self, explicit_self: &ast::ExplicitSelf) -> io::Result<()> {
         match explicit_self.node {
             SelfKind::Value(m) => {
-                self.print_mutability(m)?;
+                try!(self.print_mutability(m));
                 word(&mut self.s, "self")
             }
             SelfKind::Region(ref lt, m) => {
-                word(&mut self.s, "&")?;
-                self.print_opt_lifetime(lt)?;
-                self.print_mutability(m)?;
+                try!(word(&mut self.s, "&"));
+                try!(self.print_opt_lifetime(lt));
+                try!(self.print_mutability(m));
                 word(&mut self.s, "self")
             }
             SelfKind::Explicit(ref typ, m) => {
-                self.print_mutability(m)?;
-                word(&mut self.s, "self")?;
-                self.word_space(":")?;
+                try!(self.print_mutability(m));
+                try!(word(&mut self.s, "self"));
+                try!(self.word_space(":"));
                 self.print_type(&typ)
             }
         }
@@ -2647,25 +2647,25 @@ impl<'a> State<'a> {
                     name: Option<ast::Ident>,
                     generics: &ast::Generics,
                     vis: &ast::Visibility) -> io::Result<()> {
-        self.print_fn_header_info(unsafety, constness, abi, vis)?;
+        try!(self.print_fn_header_info(unsafety, constness, abi, vis));
 
         if let Some(name) = name {
-            self.nbsp()?;
-            self.print_ident(name)?;
+            try!(self.nbsp());
+            try!(self.print_ident(name));
         }
-        self.print_generics(generics)?;
-        self.print_fn_args_and_ret(decl)?;
+        try!(self.print_generics(generics));
+        try!(self.print_fn_args_and_ret(decl));
         self.print_where_clause(&generics.where_clause)
     }
 
     pub fn print_fn_args_and_ret(&mut self, decl: &ast::FnDecl)
         -> io::Result<()> {
-        self.popen()?;
-        self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?;
+        try!(self.popen());
+        try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false)));
         if decl.variadic {
-            word(&mut self.s, ", ...")?;
+            try!(word(&mut self.s, ", ..."));
         }
-        self.pclose()?;
+        try!(self.pclose());
 
         self.print_fn_output(decl)
     }
@@ -2674,24 +2674,24 @@ impl<'a> State<'a> {
             &mut self,
             decl: &ast::FnDecl)
             -> io::Result<()> {
-        word(&mut self.s, "|")?;
-        self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, true))?;
-        word(&mut self.s, "|")?;
+        try!(word(&mut self.s, "|"));
+        try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, true)));
+        try!(word(&mut self.s, "|"));
 
         if let ast::FunctionRetTy::Default(..) = decl.output {
             return Ok(());
         }
 
-        self.space_if_not_bol()?;
-        self.word_space("->")?;
+        try!(self.space_if_not_bol());
+        try!(self.word_space("->"));
         match decl.output {
             ast::FunctionRetTy::Ty(ref ty) => {
-                self.print_type(&ty)?;
+                try!(self.print_type(&ty));
                 self.maybe_print_comment(ty.span.lo)
             }
             ast::FunctionRetTy::Default(..) => unreachable!(),
             ast::FunctionRetTy::None(span) => {
-                self.word_nbsp("!")?;
+                try!(self.word_nbsp("!"));
                 self.maybe_print_comment(span.lo)
             }
         }
@@ -2710,28 +2710,28 @@ impl<'a> State<'a> {
                         bounds: &[ast::TyParamBound])
                         -> io::Result<()> {
         if !bounds.is_empty() {
-            word(&mut self.s, prefix)?;
+            try!(word(&mut self.s, prefix));
             let mut first = true;
             for bound in bounds {
-                self.nbsp()?;
+                try!(self.nbsp());
                 if first {
                     first = false;
                 } else {
-                    self.word_space("+")?;
+                    try!(self.word_space("+"));
                 }
 
-                match *bound {
+                try!(match *bound {
                     TraitTyParamBound(ref tref, TraitBoundModifier::None) => {
                         self.print_poly_trait_ref(tref)
                     }
                     TraitTyParamBound(ref tref, TraitBoundModifier::Maybe) => {
-                        word(&mut self.s, "?")?;
+                        try!(word(&mut self.s, "?"));
                         self.print_poly_trait_ref(tref)
                     }
                     RegionTyParamBound(ref lt) => {
                         self.print_lifetime(lt)
                     }
-                }?
+                })
             }
             Ok(())
         } else {
@@ -2750,11 +2750,11 @@ impl<'a> State<'a> {
                               lifetime: &ast::LifetimeDef)
                               -> io::Result<()>
     {
-        self.print_lifetime(&lifetime.lifetime)?;
+        try!(self.print_lifetime(&lifetime.lifetime));
         let mut sep = ":";
         for v in &lifetime.bounds {
-            word(&mut self.s, sep)?;
-            self.print_lifetime(v)?;
+            try!(word(&mut self.s, sep));
+            try!(self.print_lifetime(v));
             sep = "+";
         }
         Ok(())
@@ -2769,14 +2769,14 @@ impl<'a> State<'a> {
             return Ok(());
         }
 
-        word(&mut self.s, "<")?;
+        try!(word(&mut self.s, "<"));
 
         let mut ints = Vec::new();
         for i in 0..total {
             ints.push(i);
         }
 
-        self.commasep(Inconsistent, &ints[..], |s, &idx| {
+        try!(self.commasep(Inconsistent, &ints[..], |s, &idx| {
             if idx < generics.lifetimes.len() {
                 let lifetime = &generics.lifetimes[idx];
                 s.print_lifetime_def(lifetime)
@@ -2785,19 +2785,19 @@ impl<'a> State<'a> {
                 let param = &generics.ty_params[idx];
                 s.print_ty_param(param)
             }
-        })?;
+        }));
 
-        word(&mut self.s, ">")?;
+        try!(word(&mut self.s, ">"));
         Ok(())
     }
 
     pub fn print_ty_param(&mut self, param: &ast::TyParam) -> io::Result<()> {
-        self.print_ident(param.ident)?;
-        self.print_bounds(":", &param.bounds)?;
+        try!(self.print_ident(param.ident));
+        try!(self.print_bounds(":", &param.bounds));
         match param.default {
             Some(ref default) => {
-                space(&mut self.s)?;
-                self.word_space("=")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
                 self.print_type(&default)
             }
             _ => Ok(())
@@ -2810,12 +2810,12 @@ impl<'a> State<'a> {
             return Ok(())
         }
 
-        space(&mut self.s)?;
-        self.word_space("where")?;
+        try!(space(&mut self.s));
+        try!(self.word_space("where"));
 
         for (i, predicate) in where_clause.predicates.iter().enumerate() {
             if i != 0 {
-                self.word_space(",")?;
+                try!(self.word_space(","));
             }
 
             match *predicate {
@@ -2823,29 +2823,29 @@ impl<'a> State<'a> {
                                                                              ref bounded_ty,
                                                                              ref bounds,
                                                                              ..}) => {
-                    self.print_formal_lifetime_list(bound_lifetimes)?;
-                    self.print_type(&bounded_ty)?;
-                    self.print_bounds(":", bounds)?;
+                    try!(self.print_formal_lifetime_list(bound_lifetimes));
+                    try!(self.print_type(&bounded_ty));
+                    try!(self.print_bounds(":", bounds));
                 }
                 ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
                                                                                ref bounds,
                                                                                ..}) => {
-                    self.print_lifetime(lifetime)?;
-                    word(&mut self.s, ":")?;
+                    try!(self.print_lifetime(lifetime));
+                    try!(word(&mut self.s, ":"));
 
                     for (i, bound) in bounds.iter().enumerate() {
-                        self.print_lifetime(bound)?;
+                        try!(self.print_lifetime(bound));
 
                         if i != 0 {
-                            word(&mut self.s, ":")?;
+                            try!(word(&mut self.s, ":"));
                         }
                     }
                 }
                 ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
-                    self.print_path(path, false, 0)?;
-                    space(&mut self.s)?;
-                    self.word_space("=")?;
-                    self.print_type(&ty)?;
+                    try!(self.print_path(path, false, 0));
+                    try!(space(&mut self.s));
+                    try!(self.word_space("="));
+                    try!(self.print_type(&ty));
                 }
             }
         }
@@ -2856,52 +2856,52 @@ impl<'a> State<'a> {
     pub fn print_view_path(&mut self, vp: &ast::ViewPath) -> io::Result<()> {
         match vp.node {
             ast::ViewPathSimple(ident, ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
 
                 if path.segments.last().unwrap().identifier.name !=
                         ident.name {
-                    space(&mut self.s)?;
-                    self.word_space("as")?;
-                    self.print_ident(ident)?;
+                    try!(space(&mut self.s));
+                    try!(self.word_space("as"));
+                    try!(self.print_ident(ident));
                 }
 
                 Ok(())
             }
 
             ast::ViewPathGlob(ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
                 word(&mut self.s, "::*")
             }
 
             ast::ViewPathList(ref path, ref idents) => {
                 if path.segments.is_empty() {
-                    word(&mut self.s, "{")?;
+                    try!(word(&mut self.s, "{"));
                 } else {
-                    self.print_path(path, false, 0)?;
-                    word(&mut self.s, "::{")?;
+                    try!(self.print_path(path, false, 0));
+                    try!(word(&mut self.s, "::{"));
                 }
-                self.commasep(Inconsistent, &idents[..], |s, w| {
+                try!(self.commasep(Inconsistent, &idents[..], |s, w| {
                     match w.node {
                         ast::PathListItemKind::Ident { name, rename, .. } => {
-                            s.print_ident(name)?;
+                            try!(s.print_ident(name));
                             if let Some(ident) = rename {
-                                space(&mut s.s)?;
-                                s.word_space("as")?;
-                                s.print_ident(ident)?;
+                                try!(space(&mut s.s));
+                                try!(s.word_space("as"));
+                                try!(s.print_ident(ident));
                             }
                             Ok(())
                         },
                         ast::PathListItemKind::Mod { rename, .. } => {
-                            word(&mut s.s, "self")?;
+                            try!(word(&mut s.s, "self"));
                             if let Some(ident) = rename {
-                                space(&mut s.s)?;
-                                s.word_space("as")?;
-                                s.print_ident(ident)?;
+                                try!(space(&mut s.s));
+                                try!(s.word_space("as"));
+                                try!(s.print_ident(ident));
                             }
                             Ok(())
                         }
                     }
-                })?;
+                }));
                 word(&mut self.s, "}")
             }
         }
@@ -2916,17 +2916,17 @@ impl<'a> State<'a> {
     }
 
     pub fn print_mt(&mut self, mt: &ast::MutTy) -> io::Result<()> {
-        self.print_mutability(mt.mutbl)?;
+        try!(self.print_mutability(mt.mutbl));
         self.print_type(&mt.ty)
     }
 
     pub fn print_arg(&mut self, input: &ast::Arg, is_closure: bool) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         match input.ty.node {
-            ast::TyKind::Infer if is_closure => self.print_pat(&input.pat)?,
+            ast::TyKind::Infer if is_closure => try!(self.print_pat(&input.pat)),
             _ => {
                 if let Some(eself) = input.to_self() {
-                    self.print_explicit_self(&eself)?;
+                    try!(self.print_explicit_self(&eself));
                 } else {
                     let invalid = if let PatKind::Ident(_, ident, _) = input.pat.node {
                         ident.node.name == keywords::Invalid.name()
@@ -2934,11 +2934,11 @@ impl<'a> State<'a> {
                         false
                     };
                     if !invalid {
-                        self.print_pat(&input.pat)?;
-                        word(&mut self.s, ":")?;
-                        space(&mut self.s)?;
+                        try!(self.print_pat(&input.pat));
+                        try!(word(&mut self.s, ":"));
+                        try!(space(&mut self.s));
                     }
-                    self.print_type(&input.ty)?;
+                    try!(self.print_type(&input.ty));
                 }
             }
         }
@@ -2950,17 +2950,17 @@ impl<'a> State<'a> {
             return Ok(());
         }
 
-        self.space_if_not_bol()?;
-        self.ibox(INDENT_UNIT)?;
-        self.word_space("->")?;
+        try!(self.space_if_not_bol());
+        try!(self.ibox(INDENT_UNIT));
+        try!(self.word_space("->"));
         match decl.output {
             ast::FunctionRetTy::None(_) =>
-                self.word_nbsp("!")?,
+                try!(self.word_nbsp("!")),
             ast::FunctionRetTy::Default(..) => unreachable!(),
             ast::FunctionRetTy::Ty(ref ty) =>
-                self.print_type(&ty)?
+                try!(self.print_type(&ty))
         }
-        self.end()?;
+        try!(self.end());
 
         match decl.output {
             ast::FunctionRetTy::Ty(ref output) => self.maybe_print_comment(output.span.lo),
@@ -2975,10 +2975,10 @@ impl<'a> State<'a> {
                        name: Option<ast::Ident>,
                        generics: &ast::Generics)
                        -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
-            word(&mut self.s, "for")?;
-            self.print_generics(generics)?;
+            try!(word(&mut self.s, "for"));
+            try!(self.print_generics(generics));
         }
         let generics = ast::Generics {
             lifetimes: Vec::new(),
@@ -2988,13 +2988,13 @@ impl<'a> State<'a> {
                 predicates: Vec::new(),
             },
         };
-        self.print_fn(decl,
+        try!(self.print_fn(decl,
                       unsafety,
                       ast::Constness::NotConst,
                       abi,
                       name,
                       &generics,
-                      &ast::Visibility::Inherited)?;
+                      &ast::Visibility::Inherited));
         self.end()
     }
 
@@ -3026,12 +3026,12 @@ impl<'a> State<'a> {
         // If there aren't any remaining comments, then we need to manually
         // make sure there is a line break at the end.
         if self.next_comment().is_none() {
-            hardbreak(&mut self.s)?;
+            try!(hardbreak(&mut self.s));
         }
         loop {
             match self.next_comment() {
                 Some(ref cmnt) => {
-                    self.print_comment(cmnt)?;
+                    try!(self.print_comment(cmnt));
                     self.cur_cmnt_and_lit.cur_cmnt += 1;
                 }
                 _ => break
@@ -3046,7 +3046,7 @@ impl<'a> State<'a> {
         match opt_abi {
             Some(Abi::Rust) => Ok(()),
             Some(abi) => {
-                self.word_nbsp("extern")?;
+                try!(self.word_nbsp("extern"));
                 self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
@@ -3057,7 +3057,7 @@ impl<'a> State<'a> {
                                 opt_abi: Option<Abi>) -> io::Result<()> {
         match opt_abi {
             Some(abi) => {
-                self.word_nbsp("extern")?;
+                try!(self.word_nbsp("extern"));
                 self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
@@ -3069,18 +3069,18 @@ impl<'a> State<'a> {
                                 constness: ast::Constness,
                                 abi: Abi,
                                 vis: &ast::Visibility) -> io::Result<()> {
-        word(&mut self.s, &visibility_qualified(vis, ""))?;
+        try!(word(&mut self.s, &visibility_qualified(vis, "")));
 
         match constness {
             ast::Constness::NotConst => {}
-            ast::Constness::Const => self.word_nbsp("const")?
+            ast::Constness::Const => try!(self.word_nbsp("const"))
         }
 
-        self.print_unsafety(unsafety)?;
+        try!(self.print_unsafety(unsafety));
 
         if abi != Abi::Rust {
-            self.word_nbsp("extern")?;
-            self.word_nbsp(&abi.to_string())?;
+            try!(self.word_nbsp("extern"));
+            try!(self.word_nbsp(&abi.to_string()));
         }
 
         word(&mut self.s, "fn")