mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue