Remove as_slice() calls from script.

This commit is contained in:
Ms2ger 2015-04-25 17:05:08 +02:00
parent ef536372cd
commit a862479ca8
42 changed files with 115 additions and 124 deletions

View file

@ -51,7 +51,7 @@ impl AttrValue {
}
pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue {
let tokens = atoms.iter().map(Atom::as_slice).collect::<Vec<_>>().connect("\x20");
let tokens = atoms.iter().map(|x| &**x).collect::<Vec<_>>().connect("\x20");
AttrValue::TokenList(tokens, atoms)
}
@ -67,7 +67,7 @@ impl AttrValue {
pub fn tokens<'a>(&'a self) -> Option<&'a [Atom]> {
match *self {
AttrValue::TokenList(_, ref tokens) => Some(tokens.as_slice()),
AttrValue::TokenList(_, ref tokens) => Some(tokens),
_ => None
}
}
@ -149,7 +149,7 @@ impl Attr {
impl<'a> AttrMethods for JSRef<'a, Attr> {
// https://dom.spec.whatwg.org/#dom-attr-localname
fn LocalName(self) -> DOMString {
self.local_name().as_slice().to_owned()
(**self.local_name()).to_owned()
}
// https://dom.spec.whatwg.org/#dom-attr-value
@ -191,13 +191,13 @@ impl<'a> AttrMethods for JSRef<'a, Attr> {
// https://dom.spec.whatwg.org/#dom-attr-name
fn Name(self) -> DOMString {
self.name.as_slice().to_owned()
(*self.name).to_owned()
}
// https://dom.spec.whatwg.org/#dom-attr-namespaceuri
fn GetNamespaceURI(self) -> Option<DOMString> {
let Namespace(ref atom) = self.namespace;
match atom.as_slice() {
match &**atom {
"" => None,
url => Some(url.to_owned()),
}
@ -281,7 +281,7 @@ impl<'a> AttrHelpers<'a> for JSRef<'a, Attr> {
fn summarize(self) -> AttrInfo {
let Namespace(ref ns) = self.namespace;
AttrInfo {
namespace: ns.as_slice().to_owned(),
namespace: (**ns).to_owned(),
name: self.Name(),
value: self.Value(),
}
@ -319,7 +319,7 @@ impl AttrHelpersForLayout for Attr {
// This transmute is used to cheat the lifetime restriction.
let value = mem::transmute::<&AttrValue, &AttrValue>(self.value.borrow_for_layout());
match *value {
AttrValue::TokenList(_, ref tokens) => Some(tokens.as_slice()),
AttrValue::TokenList(_, ref tokens) => Some(tokens),
_ => None,
}
}