mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Remove some as_slice calls.
This commit is contained in:
parent
4ee89363fb
commit
6a55ae06d7
34 changed files with 79 additions and 79 deletions
|
@ -12,6 +12,7 @@ use std::borrow::ToOwned;
|
|||
use std::ffi::CStr;
|
||||
use std::iter::Filter;
|
||||
use std::num::{Int, ToPrimitive};
|
||||
use std::ops::Deref;
|
||||
use std::str::{from_utf8, FromStr, Split};
|
||||
|
||||
pub type DOMString = String;
|
||||
|
@ -29,7 +30,7 @@ pub fn null_str_as_empty(s: &Option<DOMString>) -> DOMString {
|
|||
|
||||
pub fn null_str_as_empty_ref<'a>(s: &'a Option<DOMString>) -> &'a str {
|
||||
match *s {
|
||||
Some(ref s) => s.as_slice(),
|
||||
Some(ref s) => s,
|
||||
None => ""
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +232,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
|
|||
new_input.push(ch)
|
||||
}
|
||||
}
|
||||
let mut input = new_input.as_slice();
|
||||
let mut input = &*new_input;
|
||||
|
||||
// Step 8.
|
||||
for (char_count, (index, _)) in input.char_indices().enumerate() {
|
||||
|
@ -328,9 +329,11 @@ impl LowercaseString {
|
|||
}
|
||||
}
|
||||
|
||||
impl Str for LowercaseString {
|
||||
impl Deref for LowercaseString {
|
||||
type Target = str;
|
||||
|
||||
#[inline]
|
||||
fn as_slice(&self) -> &str {
|
||||
fn deref(&self) -> &str {
|
||||
&*self.inner
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue