Skip to content

Commit

Permalink
Run rustfmt on error-index-generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedcharles committed Oct 12, 2015
1 parent 81b3b27 commit f65dbb1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/error-index-generator/main.rs
Expand Up @@ -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));

Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit f65dbb1

Please sign in to comment.