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

@ -70,12 +70,11 @@ impl Blob {
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
blobPropertyBag.type_.as_slice()
&*blobPropertyBag.type_
} else {
""
};
let typeStrLower = typeString.as_slice().to_ascii_lowercase();
Ok(Blob::new(global, bytes, typeStrLower.as_slice()))
Ok(Blob::new(global, bytes, &typeString.to_ascii_lowercase()))
}
}
@ -121,7 +120,7 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
None => "".to_owned(),
Some(str) => {
if is_ascii_printable(&str) {
str.as_slice().to_ascii_lowercase().to_owned()
str.to_ascii_lowercase()
} else {
"".to_owned()
}
@ -130,13 +129,13 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
let span: i64 = max(relativeEnd - relativeStart, 0);
let global = self.global.root();
match self.bytes {
None => Blob::new(global.r(), None, relativeContentType.as_slice()),
None => Blob::new(global.r(), None, &relativeContentType),
Some(ref vec) => {
let start = relativeStart.to_usize().unwrap();
let end = (relativeStart + span).to_usize().unwrap();
let mut bytes: Vec<u8> = Vec::new();
bytes.push_all(&vec[start..end]);
Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
Blob::new(global.r(), Some(bytes), &relativeContentType)
}
}
}