1
Fork 0

cleanup: s/v.slice*()/&v[a..b]/g + remove redundant as_slice() calls

This commit is contained in:
Jorge Aparicio 2015-01-26 21:21:15 -05:00
parent d77f6d5366
commit bce81e2464
59 changed files with 156 additions and 160 deletions

View file

@ -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>"));