Skip to content

Commit

Permalink
Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
Browse files Browse the repository at this point in the history
Remove io::Result from syntax::print

Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
  • Loading branch information
bors committed Jul 5, 2019
2 parents baab191 + d26c4b7 commit f119bf2
Show file tree
Hide file tree
Showing 10 changed files with 2,076 additions and 2,280 deletions.
9 changes: 4 additions & 5 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::hir::print::Nested;
use crate::util::nodemap::FxHashMap;
use crate::util::common::time;

use std::io;
use std::result::Result::Err;
use crate::ty::query::Providers;

Expand Down Expand Up @@ -1187,7 +1186,7 @@ pub fn map_crate<'hir>(sess: &crate::session::Session,
/// Identical to the `PpAnn` implementation for `hir::Crate`,
/// except it avoids creating a dependency on the whole crate.
impl<'hir> print::PpAnn for Map<'hir> {
fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) -> io::Result<()> {
fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) {
match nested {
Nested::Item(id) => state.print_item(self.expect_item(id.id)),
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
Expand All @@ -1199,7 +1198,7 @@ impl<'hir> print::PpAnn for Map<'hir> {
}

impl<'a> print::State<'a> {
pub fn print_node(&mut self, node: Node<'_>) -> io::Result<()> {
pub fn print_node(&mut self, node: Node<'_>) {
match node {
Node::Item(a) => self.print_item(&a),
Node::ForeignItem(a) => self.print_foreign_item(&a),
Expand All @@ -1219,9 +1218,9 @@ impl<'a> print::State<'a> {
use syntax::print::pprust::PrintState;

// containing cbox, will be closed by print-block at }
self.cbox(print::indent_unit)?;
self.cbox(print::indent_unit);
// head-ibox, will be closed by print-block after {
self.ibox(0)?;
self.ibox(0);
self.print_block(&a)
}
Node::Lifetime(a) => self.print_lifetime(&a),
Expand Down
Loading

0 comments on commit f119bf2

Please sign in to comment.