Skip to content

Commit 9db76f3

Browse files
committed
Use fmt::Result instead of Result<(), Error>.
1 parent 5a0c1b3 commit 9db76f3

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/librustc/mir/repr.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_front::hir::InlineAsm;
1818
use syntax::ast::Name;
1919
use syntax::codemap::Span;
2020
use std::borrow::{Cow, IntoCow};
21-
use std::fmt::{Debug, Formatter, Error, Write};
21+
use std::fmt::{self, Debug, Formatter, Write};
2222
use std::{iter, u32};
2323

2424
/// Lowered representation of a single function.
@@ -183,7 +183,7 @@ impl BasicBlock {
183183
}
184184

185185
impl Debug for BasicBlock {
186-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
186+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
187187
write!(fmt, "bb{}", self.0)
188188
}
189189
}
@@ -317,7 +317,7 @@ impl<'tcx> BasicBlockData<'tcx> {
317317
}
318318

319319
impl<'tcx> Debug for Terminator<'tcx> {
320-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
320+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
321321
try!(self.fmt_head(fmt));
322322
let successors = self.successors();
323323
let labels = self.fmt_successor_labels();
@@ -347,7 +347,7 @@ impl<'tcx> Terminator<'tcx> {
347347
/// Write the "head" part of the terminator; that is, its name and the data it uses to pick the
348348
/// successor basic block, if any. The only information not inlcuded is the list of possible
349349
/// successors, which may be rendered differently between the text and the graphviz format.
350-
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> Result<(), Error> {
350+
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
351351
use self::Terminator::*;
352352
match *self {
353353
Goto { .. } => write!(fmt, "goto"),
@@ -421,7 +421,7 @@ pub enum DropKind {
421421
}
422422

423423
impl<'tcx> Debug for Statement<'tcx> {
424-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
424+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
425425
use self::StatementKind::*;
426426
match self.kind {
427427
Assign(ref lv, ref rv) => write!(fmt, "{:?} = {:?}", lv, rv),
@@ -541,7 +541,7 @@ impl<'tcx> Lvalue<'tcx> {
541541
}
542542

543543
impl<'tcx> Debug for Lvalue<'tcx> {
544-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
544+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
545545
use self::Lvalue::*;
546546

547547
match *self {
@@ -588,7 +588,7 @@ pub enum Operand<'tcx> {
588588
}
589589

590590
impl<'tcx> Debug for Operand<'tcx> {
591-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
591+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
592592
use self::Operand::*;
593593
match *self {
594594
Constant(ref a) => write!(fmt, "{:?}", a),
@@ -715,7 +715,7 @@ pub enum UnOp {
715715
}
716716

717717
impl<'tcx> Debug for Rvalue<'tcx> {
718-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
718+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
719719
use self::Rvalue::*;
720720

721721
match *self {
@@ -771,13 +771,13 @@ pub enum Literal<'tcx> {
771771
}
772772

773773
impl<'tcx> Debug for Constant<'tcx> {
774-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
774+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
775775
write!(fmt, "{:?}", self.literal)
776776
}
777777
}
778778

779779
impl<'tcx> Debug for Literal<'tcx> {
780-
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
780+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
781781
use self::Literal::*;
782782
match *self {
783783
Item { def_id, .. } =>
@@ -788,7 +788,7 @@ impl<'tcx> Debug for Literal<'tcx> {
788788
}
789789

790790
/// Write a `ConstVal` in a way closer to the original source code than the `Debug` output.
791-
pub fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> Result<(), Error> {
791+
pub fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> fmt::Result {
792792
use middle::const_eval::ConstVal::*;
793793
match *const_val {
794794
Float(f) => write!(fmt, "{:?}", f),

0 commit comments

Comments
 (0)