Run rustfmt on error-index-generator.

This commit is contained in:
Ahmed Charles 2015-10-11 23:44:32 -07:00
parent 81b3b27cf5
commit f65dbb1dc4

View file

@ -34,10 +34,7 @@ fn load_all_errors(metadata_dir: &Path) -> Result<ErrorMetadataMap, Box<Error>>
let path = try!(entry).path();
let mut metadata_str = String::new();
try!(
File::open(&path).and_then(|mut f|
f.read_to_string(&mut metadata_str))
);
try!(File::open(&path).and_then(|mut f| f.read_to_string(&mut metadata_str)));
let some_errors: ErrorMetadataMap = try!(json::decode(&metadata_str));
@ -78,24 +75,23 @@ r##"<!DOCTYPE html>
// Enclose each error in a div so they can be shown/hidden en masse.
let desc_desc = match info.description {
Some(_) => "error-described",
None => "error-undescribed"
None => "error-undescribed",
};
let use_desc = match info.use_site {
Some(_) => "error-used",
None => "error-unused"
None => "error-unused",
};
try!(write!(&mut output_file, "<div class=\"{} {}\">", desc_desc, use_desc));
// Error title (with self-link).
try!(write!(&mut output_file,
"<h2 id=\"{0}\" class=\"section-header\"><a href=\"#{0}\">{0}</a></h2>\n",
err_code
));
"<h2 id=\"{0}\" class=\"section-header\"><a href=\"#{0}\">{0}</a></h2>\n",
err_code));
// Description rendered as markdown.
match info.description {
Some(ref desc) => try!(write!(&mut output_file, "{}", Markdown(desc))),
None => try!(write!(&mut output_file, "<p>No description.</p>\n"))
None => try!(write!(&mut output_file, "<p>No description.</p>\n")),
}
try!(write!(&mut output_file, "</div>\n"));