diff options
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 22 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 16 | ||||
| -rw-r--r-- | src/librustdoc/passes.rs | 16 |
7 files changed, 39 insertions, 39 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 1f30dc9040d..3ee07df6ed4 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -341,10 +341,10 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt, fn is_doc_hidden(a: &clean::Attribute) -> bool { match *a { - clean::List(ref name, ref inner) if name.as_slice() == "doc" => { + clean::List(ref name, ref inner) if *name == "doc" => { inner.iter().any(|a| { match *a { - clean::Word(ref s) => s.as_slice() == "hidden", + clean::Word(ref s) => *s == "hidden", _ => false, } }) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7e02891160a..bc870d39c5d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -256,7 +256,7 @@ impl Item { pub fn doc_list<'a>(&'a self) -> Option<&'a [Attribute]> { for attr in self.attrs.iter() { match *attr { - List(ref x, ref list) if "doc" == x.as_slice() => { + List(ref x, ref list) if "doc" == *x => { return Some(list.as_slice()); } _ => {} @@ -270,7 +270,7 @@ impl Item { pub fn doc_value<'a>(&'a self) -> Option<&'a str> { for attr in self.attrs.iter() { match *attr { - NameValue(ref x, ref v) if "doc" == x.as_slice() => { + NameValue(ref x, ref v) if "doc" == *x => { return Some(v.as_slice()); } _ => {} @@ -284,7 +284,7 @@ impl Item { Some(ref l) => { for innerattr in l.iter() { match *innerattr { - Word(ref s) if "hidden" == s.as_slice() => { + Word(ref s) if "hidden" == *s => { return true } _ => (), @@ -1217,13 +1217,13 @@ impl PrimitiveType { fn find(attrs: &[Attribute]) -> Option<PrimitiveType> { for attr in attrs.iter() { let list = match *attr { - List(ref k, ref l) if k.as_slice() == "doc" => l, + List(ref k, ref l) if *k == "doc" => l, _ => continue, }; for sub_attr in list.iter() { let value = match *sub_attr { NameValue(ref k, ref v) - if k.as_slice() == "primitive" => v.as_slice(), + if *k == "primitive" => v.as_slice(), _ => continue, }; match PrimitiveType::from_str(value) { diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 9861d18ce51..0fca59962d4 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -251,8 +251,8 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool, Some(root) => { let mut root = String::from_str(root.as_slice()); for seg in path.segments[..amt].iter() { - if "super" == seg.name.as_slice() || - "self" == seg.name.as_slice() { + if "super" == seg.name || + "self" == seg.name { try!(write!(w, "{}::", seg.name)); } else { root.push_str(seg.name.as_slice()); @@ -337,7 +337,7 @@ fn primitive_link(f: &mut fmt::Formatter, Some(root) => { try!(write!(f, "<a href='{}{}/primitive.{}.html'>", root, - path.ref0().as_slice().head().unwrap(), + path.ref0().head().unwrap(), prim.to_url_str())); needs_termination = true; } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index df25daa3ca1..10563c61e14 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -231,7 +231,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { }; // Transform the contents of the header into a hyphenated string - let id = s.as_slice().words().map(|s| s.to_ascii_lower()) + let id = s.words().map(|s| s.to_ascii_lower()) .collect::<Vec<String>>().connect("-"); // This is a terrible hack working around how hoedown gives us rendered @@ -393,7 +393,7 @@ impl LangString { let mut seen_other_tags = false; let mut data = LangString::all_false(); - let mut tokens = string.as_slice().split(|c: char| + let mut tokens = string.split(|c: char| !(c == '_' || c == '-' || c.is_alphanumeric()) ); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 9eee8e04f0c..79ab452dba6 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -277,15 +277,15 @@ pub fn run(mut krate: clean::Crate, for attr in attrs.iter() { match *attr { clean::NameValue(ref x, ref s) - if "html_favicon_url" == x.as_slice() => { + if "html_favicon_url" == *x => { cx.layout.favicon = s.to_string(); } clean::NameValue(ref x, ref s) - if "html_logo_url" == x.as_slice() => { + if "html_logo_url" == *x => { cx.layout.logo = s.to_string(); } clean::NameValue(ref x, ref s) - if "html_playground_url" == x.as_slice() => { + if "html_playground_url" == *x => { cx.layout.playground_url = s.to_string(); markdown::PLAYGROUND_KRATE.with(|slot| { if slot.borrow().is_none() { @@ -295,7 +295,7 @@ pub fn run(mut krate: clean::Crate, }); } clean::Word(ref x) - if "html_no_source" == x.as_slice() => { + if "html_no_source" == *x => { cx.include_sources = false; } _ => {} @@ -434,7 +434,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String> for (i, item) in cache.search_index.iter().enumerate() { // Omit the path if it is same to that of the prior item. let path; - if lastpath.as_slice() == item.path.as_slice() { + if lastpath == item.path { path = ""; } else { lastpath = item.path.to_string(); @@ -513,10 +513,10 @@ fn write_shared(cx: &Context, if path.exists() { for line in BufferedReader::new(File::open(path)).lines() { let line = try!(line); - if !line.as_slice().starts_with(key) { + if !line.starts_with(key) { continue } - if line.as_slice().starts_with( + if line.starts_with( format!("{}['{}']", key, krate).as_slice()) { continue } @@ -670,12 +670,12 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation { // external crate for attr in e.attrs.iter() { match *attr { - clean::List(ref x, ref list) if "doc" == x.as_slice() => { + clean::List(ref x, ref list) if "doc" == *x => { for attr in list.iter() { match *attr { clean::NameValue(ref x, ref s) - if "html_root_url" == x.as_slice() => { - if s.as_slice().ends_with("/") { + if "html_root_url" == *x => { + if s.ends_with("/") { return Remote(s.to_string()); } return Remote(format!("{}/", s)); @@ -964,7 +964,7 @@ impl DocFolder for Cache { let dox = match attrs.into_iter().find(|a| { match *a { clean::NameValue(ref x, _) - if "doc" == x.as_slice() => { + if "doc" == *x => { true } _ => false diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 66108bea988..6d9e8dc722f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -299,7 +299,7 @@ fn acquire_input(input: &str, fn parse_externs(matches: &getopts::Matches) -> Result<core::Externs, String> { let mut externs = HashMap::new(); for arg in matches.opt_strs("extern").iter() { - let mut parts = arg.as_slice().splitn(1, '='); + let mut parts = arg.splitn(1, '='); let name = match parts.next() { Some(s) => s, None => { @@ -363,18 +363,18 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche for inner in nested.iter() { match *inner { clean::Word(ref x) - if "no_default_passes" == x.as_slice() => { + if "no_default_passes" == *x => { default_passes = false; } clean::NameValue(ref x, ref value) - if "passes" == x.as_slice() => { - for pass in value.as_slice().words() { + if "passes" == *x => { + for pass in value.words() { passes.push(pass.to_string()); } } clean::NameValue(ref x, ref value) - if "plugins" == x.as_slice() => { - for p in value.as_slice().words() { + if "plugins" == *x => { + for p in value.words() { plugins.push(p.to_string()); } } @@ -397,7 +397,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche for pass in passes.iter() { let plugin = match PASSES.iter() .position(|&(p, _, _)| { - p == pass.as_slice() + p == *pass }) { Some(i) => PASSES[i].val1(), None => { @@ -434,7 +434,7 @@ fn json_input(input: &str) -> Result<Output, String> { // Make sure the schema is what we expect match obj.remove(&"schema".to_string()) { Some(Json::String(version)) => { - if version.as_slice() != SCHEMA_VERSION { + if version != SCHEMA_VERSION { return Err(format!( "sorry, but I only understand version {}", SCHEMA_VERSION)) diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index 8675d2b3749..e368d7f9332 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -258,7 +258,7 @@ pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult { for attr in i.attrs.iter() { match attr { &clean::NameValue(ref x, ref s) - if "doc" == x.as_slice() => { + if "doc" == *x => { avec.push(clean::NameValue("doc".to_string(), unindent(s.as_slice()))) } @@ -283,7 +283,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { for attr in i.attrs.iter() { match *attr { clean::NameValue(ref x, ref s) - if "doc" == x.as_slice() => { + if "doc" == *x => { docstr.push_str(s.as_slice()); docstr.push('\n'); }, @@ -291,7 +291,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { } } let mut a: Vec<clean::Attribute> = i.attrs.iter().filter(|&a| match a { - &clean::NameValue(ref x, _) if "doc" == x.as_slice() => false, + &clean::NameValue(ref x, _) if "doc" == *x => false, _ => true }).map(|x| x.clone()).collect(); if docstr.len() > 0 { @@ -374,14 +374,14 @@ mod unindent_tests { fn should_unindent() { let s = " line1\n line2".to_string(); let r = unindent(s.as_slice()); - assert_eq!(r.as_slice(), "line1\nline2"); + assert_eq!(r, "line1\nline2"); } #[test] fn should_unindent_multiple_paragraphs() { let s = " line1\n\n line2".to_string(); let r = unindent(s.as_slice()); - assert_eq!(r.as_slice(), "line1\n\nline2"); + assert_eq!(r, "line1\n\nline2"); } #[test] @@ -390,7 +390,7 @@ mod unindent_tests { // base indentation and should be preserved let s = " line1\n\n line2".to_string(); let r = unindent(s.as_slice()); - assert_eq!(r.as_slice(), "line1\n\n line2"); + assert_eq!(r, "line1\n\n line2"); } #[test] @@ -402,13 +402,13 @@ mod unindent_tests { // and continue here"] let s = "line1\n line2".to_string(); let r = unindent(s.as_slice()); - assert_eq!(r.as_slice(), "line1\nline2"); + assert_eq!(r, "line1\nline2"); } #[test] fn should_not_ignore_first_line_indent_in_a_single_line_para() { let s = "line1\n\n line2".to_string(); let r = unindent(s.as_slice()); - assert_eq!(r.as_slice(), "line1\n\n line2"); + assert_eq!(r, "line1\n\n line2"); } } |
