mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove as_slice() calls from script.
This commit is contained in:
parent
ef536372cd
commit
a862479ca8
42 changed files with 115 additions and 124 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue