Skip to content

Commit e333725

Browse files
committed
use fmt::Result where applicable
1 parent 8ff4b42 commit e333725

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

src/librustc/ich/fingerprint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Fingerprint {
6767
}
6868

6969
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 {
7171
write!(formatter, "{:x}-{:x}", self.0, self.1)
7272
}
7373
}

src/librustc_data_structures/control_flow_graph/dominators/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<Node: Idx> DominatorTree<Node> {
175175
}
176176

177177
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 {
179179
fmt::Debug::fmt(&DominatorTreeNode {
180180
tree: self,
181181
node: self.root,
@@ -190,7 +190,7 @@ struct DominatorTreeNode<'tree, Node: Idx> {
190190
}
191191

192192
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 {
194194
let subtrees: Vec<_> = self.tree
195195
.children(self.node)
196196
.iter()

src/librustc_data_structures/owning_ref/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ impl<O, T: ?Sized> Debug for OwningRef<O, T>
10021002
where O: Debug,
10031003
T: Debug,
10041004
{
1005-
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1005+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10061006
write!(f,
10071007
"OwningRef {{ owner: {:?}, reference: {:?} }}",
10081008
self.owner(),
@@ -1014,7 +1014,7 @@ impl<O, T: ?Sized> Debug for OwningRefMut<O, T>
10141014
where O: Debug,
10151015
T: Debug,
10161016
{
1017-
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
1017+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10181018
write!(f,
10191019
"OwningRefMut {{ owner: {:?}, reference: {:?} }}",
10201020
self.owner(),
@@ -1047,7 +1047,7 @@ unsafe impl<O, T: ?Sized> Sync for OwningRefMut<O, T>
10471047
where O: Sync, for<'a> (&'a mut T): Sync {}
10481048

10491049
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 {
10511051
write!(f, "<Erased>",)
10521052
}
10531053
}

src/librustc_errors/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl FatalError {
232232
}
233233

234234
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 {
236236
write!(f, "parser fatal error")
237237
}
238238
}
@@ -249,7 +249,7 @@ impl error::Error for FatalError {
249249
pub struct ExplicitBug;
250250

251251
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 {
253253
write!(f, "parser internal bug")
254254
}
255255
}

src/librustc_mir/borrow_check/nll/region_infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ impl<'tcx> RegionDefinition<'tcx> {
11851185
}
11861186

11871187
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 {
11891189
write!(
11901190
formatter,
11911191
"({:?}: {:?} @ {:?}) due to {:?}",

src/librustc_mir/transform/elaborate_drops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct Elaborator<'a, 'b: 'a, 'tcx: 'b> {
174174
}
175175

176176
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 {
178178
Ok(())
179179
}
180180
}

src/librustdoc/html/render.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2579,7 +2579,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
25792579
}
25802580

25812581
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 {
25832583
write!(w, "<li><table class='table-display'><tbody><tr><td><code>")?;
25842584
// If there's already another implementor that has the same abbridged name, use the
25852585
// full path, for example in `std::iter::ExactSizeIterator`
@@ -2612,7 +2612,7 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter,
26122612

26132613
fn render_impls(cx: &Context, w: &mut fmt::Formatter,
26142614
traits: &[&&Impl],
2615-
containing_item: &clean::Item) -> Result<(), fmt::Error> {
2615+
containing_item: &clean::Item) -> fmt::Result {
26162616
for i in traits {
26172617
let did = i.trait_did().unwrap();
26182618
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);

src/libstd/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
14601460

14611461
#[stable(feature = "rust1", since = "1.0.0")]
14621462
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 {
14641464
fmt::Debug::fmt(&**self, formatter)
14651465
}
14661466
}

src/libstd/sys/redox/syscall/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ impl Error {
4848
}
4949

5050
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 {
5252
f.write_str(self.text())
5353
}
5454
}
5555

5656
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 {
5858
f.write_str(self.text())
5959
}
6060
}

src/libstd/sys_common/wtf8.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub struct CodePoint {
5656
/// Example: `U+1F4A9`
5757
impl fmt::Debug for CodePoint {
5858
#[inline]
59-
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
59+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6060
write!(formatter, "U+{:04X}", self.value)
6161
}
6262
}
@@ -144,7 +144,7 @@ impl ops::DerefMut for Wtf8Buf {
144144
/// Example: `"a\u{D800}"` for a string with code points [U+0061, U+D800]
145145
impl fmt::Debug for Wtf8Buf {
146146
#[inline]
147-
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
147+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
148148
fmt::Debug::fmt(&**self, formatter)
149149
}
150150
}

src/libsyntax_ext/format_foreign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ mod strcursor {
989989
}
990990

991991
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 {
993993
write!(fmt, "StrCursor({:?} | {:?})", self.slice_before(), self.slice_after())
994994
}
995995
}

src/test/run-pass/atomic-print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::{env, fmt, process, sync, thread};
1515

1616
struct SlowFmt(u32);
1717
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 {
1919
thread::sleep_ms(3);
2020
self.0.fmt(f)
2121
}

src/test/run-pass/union/union-trait-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ union U {
1515
}
1616

1717
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 {
1919
unsafe { write!(f, "Oh hai {}", self.a) }
2020
}
2121
}

0 commit comments

Comments
 (0)