use fmt::Result where applicable · rust-lang/rust@e333725 (original) (raw)

13 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ impl Fingerprint {
67 67 }
68 68
69 69 impl ::std::fmt::Display for Fingerprint {
70 -fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
70 +fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
71 71 write!(formatter, "{:x}-{:x}", self.0, self.1)
72 72 }
73 73 }
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ impl<Node: Idx> DominatorTree {
175 175 }
176 176
177 177 impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
178 -fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
178 +fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
179 179 fmt::Debug::fmt(&DominatorTreeNode {
180 180 tree: self,
181 181 node: self.root,
@@ -190,7 +190,7 @@ struct DominatorTreeNode<'tree, Node: Idx> {
190 190 }
191 191
192 192 impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
193 -fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
193 +fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
194 194 let subtrees: Vec<_> = self.tree
195 195 .children(self.node)
196 196 .iter()
Original file line number Diff line number Diff line change
@@ -1002,7 +1002,7 @@ impl<O, T: ?Sized> Debug for OwningRef<O, T>
1002 1002 where O: Debug,
1003 1003 T: Debug,
1004 1004 {
1005 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1005 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1006 1006 write!(f,
1007 1007 "OwningRef {{ owner: {:?}, reference: {:?} }}",
1008 1008 self.owner(),
@@ -1014,7 +1014,7 @@ impl<O, T: ?Sized> Debug for OwningRefMut<O, T>
1014 1014 where O: Debug,
1015 1015 T: Debug,
1016 1016 {
1017 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1017 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1018 1018 write!(f,
1019 1019 "OwningRefMut {{ owner: {:?}, reference: {:?} }}",
1020 1020 self.owner(),
@@ -1047,7 +1047,7 @@ unsafe impl<O, T: ?Sized> Sync for OwningRefMut<O, T>
1047 1047 where O: Sync, for<'a> (&'a mut T): Sync {}
1048 1048
1049 1049 impl Debug for Erased {
1050 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1050 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1051 1051 write!(f, "",)
1052 1052 }
1053 1053 }
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ impl FatalError {
232 232 }
233 233
234 234 impl fmt::Display for FatalError {
235 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
235 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
236 236 write!(f, "parser fatal error")
237 237 }
238 238 }
@@ -249,7 +249,7 @@ impl error::Error for FatalError {
249 249 pub struct ExplicitBug;
250 250
251 251 impl fmt::Display for ExplicitBug {
252 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
252 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
253 253 write!(f, "parser internal bug")
254 254 }
255 255 }
Original file line number Diff line number Diff line change
@@ -1185,7 +1185,7 @@ impl<'tcx> RegionDefinition<'tcx> {
1185 1185 }
1186 1186
1187 1187 impl fmt::Debug for Constraint {
1188 -fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1188 +fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1189 1189 write!(
1190 1190 formatter,
1191 1191 "({:?}: {:?} @ {:?}) due to {:?}",
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ struct Elaborator<'a, 'b: 'a, 'tcx: 'b> {
174 174 }
175 175
176 176 impl<'a, 'b, 'tcx> fmt::Debug for Elaborator<'a, 'b, 'tcx> {
177 -fn fmt(&self, _f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
177 +fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
178 178 Ok(())
179 179 }
180 180 }
Original file line number Diff line number Diff line change
@@ -2579,7 +2579,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2579 2579 }
2580 2580
2581 2581 fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
2582 -implementor_dups: &FxHashMap<&str, (DefId, bool)>) -> Result<(), fmt::Error> {
2582 +implementor_dups: &FxHashMap<&str, (DefId, bool)>) -> fmt::Result {
2583 2583 write!(w, "
  • ")?;
    2584 2584 // If there's already another implementor that has the same abbridged name, use the
    2585 2585 // full path, for example in `std::iter::ExactSizeIterator`
    @@ -2612,7 +2612,7 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
    2612 2612
    2613 2613 fn render_impls(cx: &Context, w: &mut fmt::Formatter,
    2614 2614 traits: &[&&Impl],
    2615 -containing_item: &clean::Item) -> Result<(), fmt::Error> {
    2615 +containing_item: &clean::Item) -> fmt::Result {
    2616 2616 for i in traits {
    2617 2617 let did = i.trait_did().unwrap();
    2618 2618 let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
    Original file line number Diff line number Diff line change
    @@ -1460,7 +1460,7 @@ impl> iter::Extend

    for PathBuf {

    1460 1460
    1461 1461 #[stable(feature = "rust1", since = "1.0.0")]
    1462 1462 impl fmt::Debug for PathBuf {
    1463 -fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
    1463 +fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    1464 1464 fmt::Debug::fmt(&**self, formatter)
    1465 1465 }
    1466 1466 }
    Original file line number Diff line number Diff line change
    @@ -48,13 +48,13 @@ impl Error {
    48 48 }
    49 49
    50 50 impl fmt::Debug for Error {
    51 -fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
    51 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    52 52 f.write_str(self.text())
    53 53 }
    54 54 }
    55 55
    56 56 impl fmt::Display for Error {
    57 -fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
    57 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    58 58 f.write_str(self.text())
    59 59 }
    60 60 }
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ pub struct CodePoint {
    56 56 /// Example: `U+1F4A9`
    57 57 impl fmt::Debug for CodePoint {
    58 58 #[inline]
    59 -fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
    59 +fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    60 60 write!(formatter, "U+{:04X}", self.value)
    61 61 }
    62 62 }
    @@ -144,7 +144,7 @@ impl ops::DerefMut for Wtf8Buf {
    144 144 /// Example: `"a\u{D800}"` for a string with code points [U+0061, U+D800]
    145 145 impl fmt::Debug for Wtf8Buf {
    146 146 #[inline]
    147 -fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
    147 +fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    148 148 fmt::Debug::fmt(&**self, formatter)
    149 149 }
    150 150 }
    Original file line number Diff line number Diff line change
    @@ -989,7 +989,7 @@ mod strcursor {
    989 989 }
    990 990
    991 991 impl<'a> std::fmt::Debug for StrCursor<'a> {
    992 -fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
    992 +fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
    993 993 write!(fmt, "StrCursor({:?} | {:?})", self.slice_before(), self.slice_after())
    994 994 }
    995 995 }
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ use std::{env, fmt, process, sync, thread};
    15 15
    16 16 struct SlowFmt(u32);
    17 17 impl fmt::Debug for SlowFmt {
    18 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
    18 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    19 19 thread::sleep_ms(3);
    20 20 self.0.fmt(f)
    21 21 }
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ union U {
    15 15 }
    16 16
    17 17 impl fmt::Display for U {
    18 -fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
    18 +fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    19 19 unsafe { write!(f, "Oh hai {}", self.a) }
    20 20 }
    21 21 }