Revert "Use slice syntax instead of slice_to, etc."

This reverts commit 40b9f5ded5.
This commit is contained in:
Aaron Turon 2014-10-02 11:48:07 -07:00
parent c0c6c89589
commit d2ea0315e0
81 changed files with 363 additions and 331 deletions

View file

@ -698,7 +698,7 @@ impl Clean<Item> for ast::Method {
let all_inputs = &self.pe_fn_decl().inputs;
let inputs = match self.pe_explicit_self().node {
ast::SelfStatic => all_inputs.as_slice(),
_ => all_inputs[1..]
_ => all_inputs.slice_from(1)
};
let decl = FnDecl {
inputs: Arguments {
@ -737,7 +737,7 @@ impl Clean<Item> for ast::TypeMethod {
fn clean(&self, cx: &DocContext) -> Item {
let inputs = match self.explicit_self.node {
ast::SelfStatic => self.decl.inputs.as_slice(),
_ => self.decl.inputs[1..]
_ => self.decl.inputs.slice_from(1)
};
let decl = FnDecl {
inputs: Arguments {
@ -1009,7 +1009,7 @@ impl Clean<Item> for ty::Method {
self.fty.sig.clone()),
s => {
let sig = ty::FnSig {
inputs: self.fty.sig.inputs[1..].to_vec(),
inputs: self.fty.sig.inputs.slice_from(1).to_vec(),
..self.fty.sig.clone()
};
let s = match s {

View file

@ -249,7 +249,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool,
match rel_root {
Some(root) => {
let mut root = String::from_str(root.as_slice());
for seg in path.segments[..amt].iter() {
for seg in path.segments.slice_to(amt).iter() {
if "super" == seg.name.as_slice() ||
"self" == seg.name.as_slice() {
try!(write!(w, "{}::", seg.name));
@ -264,7 +264,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool,
}
}
None => {
for seg in path.segments[..amt].iter() {
for seg in path.segments.slice_to(amt).iter() {
try!(write!(w, "{}::", seg.name));
}
}
@ -275,7 +275,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool,
// This is a documented path, link to it!
Some((ref fqp, shortty)) if abs_root.is_some() => {
let mut url = String::from_str(abs_root.unwrap().as_slice());
let to_link = fqp[..fqp.len() - 1];
let to_link = fqp.slice_to(fqp.len() - 1);
for component in to_link.iter() {
url.push_str(component.as_slice());
url.push_str("/");

View file

@ -394,7 +394,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
search_index.push(IndexItem {
ty: shortty(item),
name: item.name.clone().unwrap(),
path: fqp[..fqp.len() - 1].connect("::"),
path: fqp.slice_to(fqp.len() - 1).connect("::"),
desc: shorter(item.doc_value()).to_string(),
parent: Some(did),
});
@ -549,7 +549,7 @@ fn write_shared(cx: &Context,
};
let mut mydst = dst.clone();
for part in remote_path[..remote_path.len() - 1].iter() {
for part in remote_path.slice_to(remote_path.len() - 1).iter() {
mydst.push(part.as_slice());
try!(mkdir(&mydst));
}
@ -829,7 +829,7 @@ impl DocFolder for Cache {
clean::StructFieldItem(..) |
clean::VariantItem(..) => {
((Some(*self.parent_stack.last().unwrap()),
Some(self.stack[..self.stack.len() - 1])),
Some(self.stack.slice_to(self.stack.len() - 1))),
false)
}
clean::MethodItem(..) => {
@ -840,13 +840,13 @@ impl DocFolder for Cache {
let did = *last;
let path = match self.paths.find(&did) {
Some(&(_, item_type::Trait)) =>
Some(self.stack[..self.stack.len() - 1]),
Some(self.stack.slice_to(self.stack.len() - 1)),
// The current stack not necessarily has correlation for
// where the type was defined. On the other hand,
// `paths` always has the right information if present.
Some(&(ref fqp, item_type::Struct)) |
Some(&(ref fqp, item_type::Enum)) =>
Some(fqp[..fqp.len() - 1]),
Some(fqp.slice_to(fqp.len() - 1)),
Some(..) => Some(self.stack.as_slice()),
None => None
};
@ -1172,7 +1172,7 @@ impl Context {
let mut url = "../".repeat(cx.current.len());
match cache_key.get().unwrap().paths.find(&it.def_id) {
Some(&(ref names, _)) => {
for name in names[..names.len() - 1].iter() {
for name in names.slice_to(names.len() - 1).iter() {
url.push_str(name.as_slice());
url.push_str("/");
}