Skip to content

Commit 6132f7f

Browse files
committed
rustdoc: Remove io_error usage
1 parent e0f0a2f commit 6132f7f

File tree

7 files changed

+495
-416
lines changed

7 files changed

+495
-416
lines changed

src/librustdoc/html/escape.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::fmt;
2020
pub struct Escape<'a>(&'a str);
2121

2222
impl<'a> fmt::Show for Escape<'a> {
23-
fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) {
23+
fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) -> fmt::Result {
2424
// Because the internet is always right, turns out there's not that many
2525
// characters to escape: http://stackoverflow.com/questions/7381974
2626
let Escape(s) = *s;
@@ -29,7 +29,7 @@ impl<'a> fmt::Show for Escape<'a> {
2929
for (i, ch) in s.bytes().enumerate() {
3030
match ch as char {
3131
'<' | '>' | '&' | '\'' | '"' => {
32-
fmt.buf.write(pile_o_bits.slice(last, i).as_bytes());
32+
if_ok!(fmt.buf.write(pile_o_bits.slice(last, i).as_bytes()));
3333
let s = match ch as char {
3434
'>' => "&gt;",
3535
'<' => "&lt;",
@@ -38,15 +38,16 @@ impl<'a> fmt::Show for Escape<'a> {
3838
'"' => "&quot;",
3939
_ => unreachable!()
4040
};
41-
fmt.buf.write(s.as_bytes());
41+
if_ok!(fmt.buf.write(s.as_bytes()));
4242
last = i + 1;
4343
}
4444
_ => {}
4545
}
4646
}
4747

4848
if last < s.len() {
49-
fmt.buf.write(pile_o_bits.slice_from(last).as_bytes());
49+
if_ok!(fmt.buf.write(pile_o_bits.slice_from(last).as_bytes()));
5050
}
51+
Ok(())
5152
}
5253
}

0 commit comments

Comments
 (0)