Use fmt::Result instead of Result<(), Error>.

This commit is contained in:
Scott Olson 2015-12-31 20:11:25 -06:00
parent 5a0c1b3a88
commit 9db76f311d

View File

@ -18,7 +18,7 @@ use rustc_front::hir::InlineAsm;
use syntax::ast::Name;
use syntax::codemap::Span;
use std::borrow::{Cow, IntoCow};
use std::fmt::{Debug, Formatter, Error, Write};
use std::fmt::{self, Debug, Formatter, Write};
use std::{iter, u32};
/// Lowered representation of a single function.
@ -183,7 +183,7 @@ impl BasicBlock {
}
impl Debug for BasicBlock {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "bb{}", self.0)
}
}
@ -317,7 +317,7 @@ impl<'tcx> BasicBlockData<'tcx> {
}
impl<'tcx> Debug for Terminator<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
try!(self.fmt_head(fmt));
let successors = self.successors();
let labels = self.fmt_successor_labels();
@ -347,7 +347,7 @@ impl<'tcx> Terminator<'tcx> {
/// Write the "head" part of the terminator; that is, its name and the data it uses to pick the
/// successor basic block, if any. The only information not inlcuded is the list of possible
/// successors, which may be rendered differently between the text and the graphviz format.
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> Result<(), Error> {
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
use self::Terminator::*;
match *self {
Goto { .. } => write!(fmt, "goto"),
@ -421,7 +421,7 @@ pub enum DropKind {
}
impl<'tcx> Debug for Statement<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
use self::StatementKind::*;
match self.kind {
Assign(ref lv, ref rv) => write!(fmt, "{:?} = {:?}", lv, rv),
@ -541,7 +541,7 @@ impl<'tcx> Lvalue<'tcx> {
}
impl<'tcx> Debug for Lvalue<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
use self::Lvalue::*;
match *self {
@ -588,7 +588,7 @@ pub enum Operand<'tcx> {
}
impl<'tcx> Debug for Operand<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
use self::Operand::*;
match *self {
Constant(ref a) => write!(fmt, "{:?}", a),
@ -715,7 +715,7 @@ pub enum UnOp {
}
impl<'tcx> Debug for Rvalue<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
use self::Rvalue::*;
match *self {
@ -771,13 +771,13 @@ pub enum Literal<'tcx> {
}
impl<'tcx> Debug for Constant<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "{:?}", self.literal)
}
}
impl<'tcx> Debug for Literal<'tcx> {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
use self::Literal::*;
match *self {
Item { def_id, .. } =>
@ -788,7 +788,7 @@ impl<'tcx> Debug for Literal<'tcx> {
}
/// Write a `ConstVal` in a way closer to the original source code than the `Debug` output.
pub fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> Result<(), Error> {
pub fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> fmt::Result {
use middle::const_eval::ConstVal::*;
match *const_val {
Float(f) => write!(fmt, "{:?}", f),