Auto merge of #21680 - japaric:slice, r=alexcrichton
Replaces `slice_*` method calls with slicing syntax, and removes `as_slice()` calls that are redundant due to `Deref`.
This commit is contained in:
commit
bedd8108dc
59 changed files with 156 additions and 160 deletions
|
@ -753,7 +753,7 @@ impl fmt::Display for ModuleSummary {
|
|||
|
||||
try!(write!(f, "<tr>"));
|
||||
try!(write!(f, "<td><a href='{}'>{}</a></td>", {
|
||||
let mut url = context.slice_from(1).to_vec();
|
||||
let mut url = context[1..].to_vec();
|
||||
url.push("index.html");
|
||||
url.connect("/")
|
||||
},
|
||||
|
|
|
@ -1348,7 +1348,7 @@ impl<'a> Item<'a> {
|
|||
};
|
||||
Some(format!("{root}{path}/{file}?gotosrc={goto}",
|
||||
root = root,
|
||||
path = path.slice_to(path.len() - 1).connect("/"),
|
||||
path = path[..path.len() - 1].connect("/"),
|
||||
file = item_path(self.item),
|
||||
goto = self.item.def_id.node))
|
||||
}
|
||||
|
@ -1793,7 +1793,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
cx.current.connect("/")
|
||||
} else {
|
||||
let path = &cache.external_paths[it.def_id];
|
||||
path.slice_to(path.len() - 1).connect("/")
|
||||
path[..path.len() - 1].connect("/")
|
||||
},
|
||||
ty = shortty(it).to_static_str(),
|
||||
name = *it.name.as_ref().unwrap()));
|
||||
|
@ -2197,9 +2197,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
|
|||
try!(write!(fmt, "::<wbr>"));
|
||||
}
|
||||
try!(write!(fmt, "<a href='{}index.html'>{}</a>",
|
||||
cx.root_path
|
||||
.as_slice()
|
||||
.slice_to((cx.current.len() - i - 1) * 3),
|
||||
&cx.root_path[..(cx.current.len() - i - 1) * 3],
|
||||
*name));
|
||||
}
|
||||
try!(write!(fmt, "</p>"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue