diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-20 22:36:32 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-20 23:01:43 -0800 |
| commit | 809bd3e5efa00a7a3f924bc3999568d67574e4e7 (patch) | |
| tree | edf1229ef5017fc7c4226d603b103232fbdeb244 /src/librustdoc/markdown_index_pass.rs | |
| parent | 451463ab39083e6aba5fc215a6f349236dff9872 (diff) | |
| download | rust-809bd3e5efa00a7a3f924bc3999568d67574e4e7.tar.gz rust-809bd3e5efa00a7a3f924bc3999568d67574e4e7.zip | |
rustdoc: More demoding
Diffstat (limited to 'src/librustdoc/markdown_index_pass.rs')
| -rw-r--r-- | src/librustdoc/markdown_index_pass.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/librustdoc/markdown_index_pass.rs b/src/librustdoc/markdown_index_pass.rs index 916393c0ff6..42a222b8f5f 100644 --- a/src/librustdoc/markdown_index_pass.rs +++ b/src/librustdoc/markdown_index_pass.rs @@ -51,8 +51,8 @@ fn fold_nmod( } fn build_mod_index( - doc: doc::ModDoc, - config: config::Config + +doc: doc::ModDoc, + +config: config::Config ) -> doc::Index { { entries: par::map(doc.items, |doc| { @@ -62,8 +62,8 @@ fn build_mod_index( } fn build_nmod_index( - doc: doc::NmodDoc, - config: config::Config + +doc: doc::NmodDoc, + +config: config::Config ) -> doc::Index { { entries: par::map(doc.fns, |doc| { @@ -73,8 +73,8 @@ fn build_nmod_index( } fn item_to_entry( - doc: doc::ItemTag, - config: config::Config + +doc: doc::ItemTag, + +config: config::Config ) -> doc::IndexEntry { let link = match doc { doc::ModTag(_) | doc::NmodTag(_) @@ -94,7 +94,7 @@ fn item_to_entry( } } -fn pandoc_header_id(header: ~str) -> ~str { +fn pandoc_header_id(header: &str) -> ~str { // http://johnmacfarlane.net/pandoc/README.html#headers @@ -106,10 +106,10 @@ fn pandoc_header_id(header: ~str) -> ~str { let header = maybe_use_section_id(header); return header; - fn remove_formatting(s: ~str) -> ~str { + fn remove_formatting(s: &str) -> ~str { str::replace(s, ~"`", ~"") } - fn remove_punctuation(s: ~str) -> ~str { + fn remove_punctuation(s: &str) -> ~str { let s = str::replace(s, ~"<", ~""); let s = str::replace(s, ~">", ~""); let s = str::replace(s, ~"[", ~""); @@ -124,7 +124,7 @@ fn pandoc_header_id(header: ~str) -> ~str { let s = str::replace(s, ~"^", ~""); return s; } - fn replace_with_hyphens(s: ~str) -> ~str { + fn replace_with_hyphens(s: &str) -> ~str { // Collapse sequences of whitespace to a single dash // XXX: Hacky implementation here that only covers // one or two spaces. @@ -132,9 +132,9 @@ fn pandoc_header_id(header: ~str) -> ~str { let s = str::replace(s, ~" ", ~"-"); return s; } - fn convert_to_lowercase(s: ~str) -> ~str { str::to_lower(s) } - fn remove_up_to_first_letter(s: ~str) -> ~str { s } - fn maybe_use_section_id(s: ~str) -> ~str { s } + fn convert_to_lowercase(s: &str) -> ~str { str::to_lower(s) } + fn remove_up_to_first_letter(s: &str) -> ~str { s.to_str() } + fn maybe_use_section_id(s: &str) -> ~str { s.to_str() } } #[test] @@ -232,7 +232,7 @@ fn should_index_foreign_mod_contents() { #[cfg(test)] mod test { #[legacy_exports]; - fn mk_doc(output_style: config::OutputStyle, source: ~str) -> doc::Doc { + fn mk_doc(output_style: config::OutputStyle, +source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let config = { output_style: output_style, |
