1
Fork 0

Fallout of std::str stabilization

This commit is contained in:
Alex Crichton 2014-12-10 19:46:38 -08:00
parent 4908017d59
commit 082bfde412
193 changed files with 2143 additions and 2230 deletions

View file

@ -16,7 +16,7 @@
//! them in the future to instead emit any format desired.
use std::fmt;
use std::string::String;
use std::iter::repeat;
use syntax::ast;
use syntax::ast_util;
@ -198,12 +198,12 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path,
path(w, p, print_all,
|cache, loc| {
if ast_util::is_local(did) || cache.inlined.contains(&did) {
Some(("../".repeat(loc.len())).to_string())
Some(repeat("../").take(loc.len()).collect::<String>())
} else {
match cache.extern_locations[did.krate] {
render::Remote(ref s) => Some(s.to_string()),
render::Local => {
Some(("../".repeat(loc.len())).to_string())
Some(repeat("../").take(loc.len()).collect::<String>())
}
render::Unknown => None,
}
@ -324,7 +324,7 @@ fn primitive_link(f: &mut fmt::Formatter,
let len = CURRENT_LOCATION_KEY.with(|s| s.borrow().len());
let len = if len == 0 {0} else {len - 1};
try!(write!(f, "<a href='{}primitive.{}.html'>",
"../".repeat(len),
repeat("../").take(len).collect::<String>(),
prim.to_url_str()));
needs_termination = true;
}
@ -337,7 +337,7 @@ fn primitive_link(f: &mut fmt::Formatter,
render::Remote(ref s) => Some(s.to_string()),
render::Local => {
let len = CURRENT_LOCATION_KEY.with(|s| s.borrow().len());
Some("../".repeat(len))
Some(repeat("../").take(len).collect::<String>())
}
render::Unknown => None,
};

View file

@ -34,7 +34,7 @@ pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String {
class,
id,
&mut out).unwrap();
String::from_utf8_lossy(out[]).into_string()
String::from_utf8_lossy(out[]).into_owned()
}
/// Exhausts the `lexer` writing the output into `out`.

View file

@ -42,8 +42,8 @@ use std::fmt;
use std::io::fs::PathExtensions;
use std::io::{fs, File, BufferedWriter, BufferedReader};
use std::io;
use std::iter::repeat;
use std::str;
use std::string::String;
use std::sync::Arc;
use externalfiles::ExternalHtml;
@ -1186,7 +1186,8 @@ impl Context {
&Sidebar{ cx: cx, item: it },
&Item{ cx: cx, item: it }));
} else {
let mut url = "../".repeat(cx.current.len());
let mut url = repeat("../").take(cx.current.len())
.collect::<String>();
match cache().paths.get(&it.def_id) {
Some(&(ref names, _)) => {
for name in names[..names.len() - 1].iter() {
@ -1382,7 +1383,8 @@ impl<'a> fmt::Show for Item<'a> {
let amt = if self.ismodule() { cur.len() - 1 } else { cur.len() };
for (i, component) in cur.iter().enumerate().take(amt) {
try!(write!(fmt, "<a href='{}index.html'>{}</a>::<wbr>",
"../".repeat(cur.len() - i - 1),
repeat("../").take(cur.len() - i - 1)
.collect::<String>(),
component.as_slice()));
}
}