rustdoc: Remove io_error usage
This commit is contained in:
parent
e0f0a2f67f
commit
6132f7f666
7 changed files with 494 additions and 415 deletions
|
@ -20,7 +20,7 @@ use std::fmt;
|
|||
pub struct Escape<'a>(&'a str);
|
||||
|
||||
impl<'a> fmt::Show for Escape<'a> {
|
||||
fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) {
|
||||
fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
// Because the internet is always right, turns out there's not that many
|
||||
// characters to escape: http://stackoverflow.com/questions/7381974
|
||||
let Escape(s) = *s;
|
||||
|
@ -29,7 +29,7 @@ impl<'a> fmt::Show for Escape<'a> {
|
|||
for (i, ch) in s.bytes().enumerate() {
|
||||
match ch as char {
|
||||
'<' | '>' | '&' | '\'' | '"' => {
|
||||
fmt.buf.write(pile_o_bits.slice(last, i).as_bytes());
|
||||
if_ok!(fmt.buf.write(pile_o_bits.slice(last, i).as_bytes()));
|
||||
let s = match ch as char {
|
||||
'>' => ">",
|
||||
'<' => "<",
|
||||
|
@ -38,7 +38,7 @@ impl<'a> fmt::Show for Escape<'a> {
|
|||
'"' => """,
|
||||
_ => unreachable!()
|
||||
};
|
||||
fmt.buf.write(s.as_bytes());
|
||||
if_ok!(fmt.buf.write(s.as_bytes()));
|
||||
last = i + 1;
|
||||
}
|
||||
_ => {}
|
||||
|
@ -46,7 +46,8 @@ impl<'a> fmt::Show for Escape<'a> {
|
|||
}
|
||||
|
||||
if last < s.len() {
|
||||
fmt.buf.write(pile_o_bits.slice_from(last).as_bytes());
|
||||
if_ok!(fmt.buf.write(pile_o_bits.slice_from(last).as_bytes()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue