Remove some as_slice calls.

This commit is contained in:
Ms2ger 2015-04-24 17:40:22 +02:00
parent 4ee89363fb
commit 6a55ae06d7
34 changed files with 79 additions and 79 deletions

View file

@ -32,7 +32,7 @@ struct BufferKey([usize; 2]);
impl Hash for BufferKey {
fn hash<H: Hasher>(&self, state: &mut H) {
let BufferKey(ref bytes) = *self;
bytes.as_slice().hash(state);
bytes.hash(state);
}
}

View file

@ -8,7 +8,6 @@ use platform::font_list::get_variations_for_family;
use platform::font_list::get_last_resort_font_families;
use platform::font_context::FontContextHandle;
use collections::str::Str;
use font_template::{FontTemplate, FontTemplateDescriptor};
use net_traits::{ResourceTask, load_whole_resource};
use platform::font_template::FontTemplateData;
@ -106,7 +105,7 @@ fn add_generic_font(generic_fonts: &mut HashMap<LowercaseString, LowercaseString
generic_name: &str, mapped_name: &str) {
let opt_system_default = get_system_default_family(generic_name);
let family_name = match opt_system_default {
Some(system_default) => LowercaseString::new(system_default.as_slice()),
Some(system_default) => LowercaseString::new(&system_default),
None => LowercaseString::new(mapped_name),
};
generic_fonts.insert(LowercaseString::new(generic_name), family_name);
@ -119,7 +118,7 @@ impl FontCache {
match msg {
Command::GetFontTemplate(family, descriptor, result) => {
let family = LowercaseString::new(family.as_slice());
let family = LowercaseString::new(&family);
let maybe_font_template = self.get_font_template(&family, &descriptor);
result.send(Reply::GetFontTemplateReply(maybe_font_template)).unwrap();
}
@ -128,7 +127,7 @@ impl FontCache {
result.send(Reply::GetFontTemplateReply(Some(font_template))).unwrap();
}
Command::AddWebFont(family_name, src, result) => {
let family_name = LowercaseString::new(family_name.as_slice());
let family_name = LowercaseString::new(&family_name);
if !self.web_families.contains_key(&family_name) {
let family = FontFamily::new();
self.web_families.insert(family_name.clone(), family);
@ -141,7 +140,7 @@ impl FontCache {
match maybe_resource {
Ok((_, bytes)) => {
let family = &mut self.web_families[family_name];
family.add_template(url.to_string().as_slice(), Some(bytes));
family.add_template(&url.to_string(), Some(bytes));
},
Err(_) => {
debug!("Failed to load web font: family={:?} url={}", family_name, url);
@ -150,8 +149,8 @@ impl FontCache {
}
Source::Local(ref local_family_name) => {
let family = &mut self.web_families[family_name];
get_variations_for_family(local_family_name.as_slice(), |path| {
family.add_template(path.as_slice(), None);
get_variations_for_family(&local_family_name, |path| {
family.add_template(&path, None);
});
}
}
@ -168,7 +167,7 @@ impl FontCache {
fn refresh_local_families(&mut self) {
self.local_families.clear();
get_available_families(|family_name| {
let family_name = LowercaseString::new(family_name.as_slice());
let family_name = LowercaseString::new(&family_name);
if !self.local_families.contains_key(&family_name) {
let family = FontFamily::new();
self.local_families.insert(family_name, family);
@ -188,12 +187,12 @@ impl FontCache {
// TODO(Issue #188): look up localized font family names if canonical name not found
// look up canonical name
if self.local_families.contains_key(family_name) {
debug!("FontList: Found font family with name={}", family_name.as_slice());
debug!("FontList: Found font family with name={}", &**family_name);
let s = &mut self.local_families[*family_name];
if s.templates.len() == 0 {
get_variations_for_family(family_name.as_slice(), |path| {
s.add_template(path.as_slice(), None);
get_variations_for_family(&family_name, |path| {
s.add_template(&path, None);
});
}
@ -206,7 +205,7 @@ impl FontCache {
None
} else {
debug!("FontList: Couldn't find font family with name={}", family_name.as_slice());
debug!("FontList: Couldn't find font family with name={}", &**family_name);
None
}
}
@ -237,7 +236,7 @@ impl FontCache {
let last_resort = get_last_resort_font_families();
for family in last_resort.iter() {
let family = LowercaseString::new(family.as_slice());
let family = LowercaseString::new(family);
let maybe_font_in_family = self.find_font_in_local_family(&family, desc);
if maybe_font_in_family.is_some() {
return maybe_font_in_family.unwrap();

View file

@ -164,7 +164,7 @@ impl FontContext {
// GWTODO: Check on real pages if this is faster as Vec() or HashMap().
let mut cache_hit = false;
for cached_font_entry in self.layout_font_cache.iter() {
if cached_font_entry.family.as_slice() == family.name() {
if cached_font_entry.family == family.name() {
match cached_font_entry.font {
None => {
cache_hit = true;

View file

@ -158,7 +158,7 @@ impl FontTemplate {
}
assert!(self.strong_ref.is_none());
let template_data = Arc::new(FontTemplateData::new(self.identifier.as_slice(), None));
let template_data = Arc::new(FontTemplateData::new(&self.identifier, None));
self.weak_ref = Some(template_data.downgrade());
template_data
}

View file

@ -133,8 +133,8 @@ impl<'a> PaintContext<'a> {
image_rendering: image_rendering::T) {
let size = Size2D(image.width as i32, image.height as i32);
let (pixel_width, pixels, source_format) = match image.pixels {
PixelsByColorType::RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8),
PixelsByColorType::K8(ref pixels) => (1, pixels.as_slice(), SurfaceFormat::A8),
PixelsByColorType::RGBA8(ref pixels) => (4, pixels, SurfaceFormat::B8G8R8A8),
PixelsByColorType::K8(ref pixels) => (1, pixels, SurfaceFormat::A8),
PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
};

View file

@ -24,7 +24,7 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F:
debug!("Looking for faces of family: {}", family_name);
let family_collection =
core_text::font_collection::create_for_family(family_name.as_slice());
core_text::font_collection::create_for_family(family_name);
match family_collection {
Some(family_collection) => {
let family_descriptors = family_collection.get_descriptors();

View file

@ -26,7 +26,7 @@ impl FontTemplateData {
pub fn new(identifier: &str, font_data: Option<Vec<u8>>) -> FontTemplateData {
let ctfont = match font_data {
Some(ref bytes) => {
let fontprov = CGDataProvider::from_buffer(bytes.as_slice());
let fontprov = CGDataProvider::from_buffer(bytes);
let cgfont_result = CGFont::from_data_provider(fontprov);
match cgfont_result {
Ok(cgfont) => Some(core_text::font::new_from_CGFont(&cgfont, 0.0)),
@ -34,7 +34,7 @@ impl FontTemplateData {
}
},
None => {
Some(core_text::font::new_from_name(identifier.as_slice(), 0.0).unwrap())
Some(core_text::font::new_from_name(&identifier, 0.0).unwrap())
}
};

View file

@ -359,7 +359,7 @@ impl<'a> DetailedGlyphStore {
detail_offset: 0, // unused
};
let i = (&*self.detail_lookup).binary_search_index(&key)
let i = self.detail_lookup.binary_search_index(&key)
.expect("Invalid index not found in detailed glyph lookup table!");
assert!(i + (count as usize) <= self.detail_buffer.len());
@ -379,7 +379,7 @@ impl<'a> DetailedGlyphStore {
detail_offset: 0, // unused
};
let i = self.detail_lookup.as_slice().binary_search_index(&key)
let i = self.detail_lookup.binary_search_index(&key)
.expect("Invalid index not found in detailed glyph lookup table!");
assert!(i + (detail_offset as usize) < self.detail_buffer.len());

View file

@ -119,7 +119,7 @@ impl<'a> Eq for ApplicableDeclarationsCacheQuery<'a> {}
impl<'a> PartialEq<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsCacheQuery<'a> {
fn eq(&self, other: &ApplicableDeclarationsCacheEntry) -> bool {
let other_as_query = ApplicableDeclarationsCacheQuery::new(other.declarations.as_slice());
let other_as_query = ApplicableDeclarationsCacheQuery::new(&other.declarations);
self.eq(&other_as_query)
}
}
@ -279,7 +279,7 @@ impl StyleSharingCandidate {
match (&self.class, element.get_attr(&ns!(""), &atom!("class"))) {
(&None, Some(_)) | (&Some(_), None) => return false,
(&Some(ref this_class), Some(element_class)) if
element_class != this_class.as_slice() => {
element_class != &**this_class => {
return false
}
(&Some(_), Some(_)) | (&None, None) => {}

View file

@ -1506,7 +1506,7 @@ impl Fragment {
}
match self.specific {
SpecificFragmentInfo::UnscannedText(ref text_fragment_info) => {
util::str::is_whitespace(text_fragment_info.text.as_slice())
util::str::is_whitespace(&text_fragment_info.text)
}
_ => false,
}

View file

@ -186,7 +186,7 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> {
let mut temporary_counter = Counter::new();
let counter = self.traversal
.counters
.get(counter_name.as_slice())
.get(&*counter_name)
.unwrap_or(&mut temporary_counter);
new_info = counter.render(self.traversal.layout_context,
fragment.node,
@ -200,13 +200,13 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> {
let mut temporary_counter = Counter::new();
let counter = self.traversal
.counters
.get(counter_name.as_slice())
.get(&*counter_name)
.unwrap_or(&mut temporary_counter);
new_info = counter.render(self.traversal.layout_context,
fragment.node,
fragment.style.clone(),
counter_style,
RenderingMode::All(separator.as_slice()));
RenderingMode::All(&separator));
}
GeneratedContentInfo::ContentItem(ContentItem::OpenQuote) => {
new_info = Some(render_text(self.traversal.layout_context,

View file

@ -1384,7 +1384,7 @@ impl Flow for InlineFlow {
kid.assign_block_size_for_inorder_child_if_necessary(layout_context, thread_id);
}
self.base.position.size.block = match self.lines.as_slice().last() {
self.base.position.size.block = match self.lines.last() {
Some(ref last_line) => last_line.bounds.start.b + last_line.bounds.size.block,
None => Au(0),
};

View file

@ -600,7 +600,7 @@ impl LayoutTask {
// TODO we don't really even need to load this if mq does not match
let (metadata, iter) = load_bytes_iter(&self.resource_task, url);
let protocol_encoding_label = metadata.charset.as_ref().map(|s| s.as_slice());
let protocol_encoding_label = metadata.charset.as_ref().map(|s| &**s);
let final_url = metadata.final_url;
let sheet = Stylesheet::from_bytes_iter(iter,

View file

@ -169,7 +169,7 @@ impl TableFlow {
TableLayout::Auto => {
computation.union_block(&TableFlow::update_automatic_column_inline_sizes(
column_inline_sizes,
row.cell_intrinsic_inline_sizes.as_slice()))
&row.cell_intrinsic_inline_sizes))
}
}
}
@ -348,7 +348,7 @@ impl Flow for TableFlow {
self.block_flow.base.flags.remove(IMPACTED_BY_RIGHT_FLOATS);
let info = ChildInlineSizeInfo {
column_computed_inline_sizes: self.column_computed_inline_sizes.as_slice(),
column_computed_inline_sizes: &self.column_computed_inline_sizes,
spacing: spacing_per_cell,
};
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,

View file

@ -281,7 +281,7 @@ impl Flow for TableRowFlow {
// Push those inline sizes down to the cells.
let info = ChildInlineSizeInfo {
column_computed_inline_sizes: computed_inline_size_for_cells.as_slice(),
column_computed_inline_sizes: &computed_inline_size_for_cells,
spacing: self.spacing,
};
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,

View file

@ -111,7 +111,7 @@ impl Flow for TableRowGroupFlow {
containing_block_inline_size);
let info = ChildInlineSizeInfo {
column_computed_inline_sizes: self.column_computed_inline_sizes.as_slice(),
column_computed_inline_sizes: &self.column_computed_inline_sizes,
spacing: self.spacing,
};
self.block_flow.propagate_assigned_inline_size_to_children(layout_context,

View file

@ -324,7 +324,7 @@ impl Flow for TableWrapperFlow {
}
Some(ref assigned_column_inline_sizes) => {
let info = ChildInlineSizeInfo {
column_computed_inline_sizes: assigned_column_inline_sizes.as_slice(),
column_computed_inline_sizes: &assigned_column_inline_sizes,
spacing: self.block_flow.fragment.style().get_inheritedtable().border_spacing,
};
self.block_flow

View file

@ -142,7 +142,7 @@ impl TextRunScanner {
};
let old_length = CharIndex(run_text.chars().count() as isize);
last_whitespace = util::transform_text(in_fragment.as_slice(),
last_whitespace = util::transform_text(&in_fragment,
compression,
last_whitespace,
&mut run_text);

View file

@ -254,7 +254,7 @@ impl<'ln> LayoutNode<'ln> {
s.push_str(" ");
}
s.push_str(self.debug_str().as_slice());
s.push_str(&self.debug_str());
println!("{}", s);
for kid in self.children() {

View file

@ -233,7 +233,7 @@ impl ImageCache {
ResponseAction::HeadersAvailable(_) => {}
ResponseAction::DataAvailable(data) => {
let pending_load = self.pending_loads.get_mut(&msg.url).unwrap();
pending_load.bytes.push_all(data.as_slice());
pending_load.bytes.push_all(&data);
}
ResponseAction::ResponseComplete(result) => {
match result {
@ -246,7 +246,7 @@ impl ImageCache {
let sender = self.decoder_sender.clone();
self.task_pool.execute(move || {
let image = load_from_memory(bytes.as_slice());
let image = load_from_memory(&bytes);
let msg = DecoderMsg {
url: url,
image: image

View file

@ -28,7 +28,7 @@ impl MIMEClassifier {
return self.sniff_unknown_type(!no_sniff, data);
}
Some((ref media_type, ref media_subtype)) => {
match (media_type.as_slice(), media_subtype.as_slice()) {
match (&**media_type, &**media_subtype) {
("uknown", "unknown") | ("application", "uknown") | ("*", "*") => {
return self.sniff_unknown_type(!no_sniff,data);
}
@ -50,14 +50,14 @@ impl MIMEClassifier {
.or(supplied_type.clone());
}
if media_type.as_slice() == "image" {
if &**media_type == "image" {
let tp = self.image_classifier.classify(data);
if tp.is_some() {
return tp;
}
}
match (media_type.as_slice(), media_subtype.as_slice()) {
match (&**media_type, &**media_subtype) {
("audio", _) | ("video", _) | ("application", "ogg") => {
let tp = self.audio_video_classifer.classify(data);
if tp.is_some() {

View file

@ -34,9 +34,9 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
match png::load_png_from_memory(buffer) {
Ok(mut png_image) => {
match png_image.pixels {
png::PixelsByColorType::RGB8(ref mut data) => byte_swap(data.as_mut_slice()),
png::PixelsByColorType::RGB8(ref mut data) => byte_swap(data),
png::PixelsByColorType::RGBA8(ref mut data) => {
byte_swap_and_premultiply(data.as_mut_slice())
byte_swap_and_premultiply(data)
}
_ => {}
}
@ -54,9 +54,9 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
assert!(image.depth == 4);
// handle gif separately because the alpha-channel has to be premultiplied
if is_gif(buffer) {
byte_swap_and_premultiply(image.data.as_mut_slice());
byte_swap_and_premultiply(&mut image.data);
} else {
byte_swap(image.data.as_mut_slice());
byte_swap(&mut image.data);
}
Some(png::Image {
width: image.width as u32,

View file

@ -48,11 +48,11 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
match (res, it.count()) {
(Some((s, span)), 0) => {
let new_s = s.chars().map(transform).collect::<String>();
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice())))
base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(&new_s)))
}
(_, rest) => {
if rest > 0 {
cx.span_err(sp, format!("expected 1 argument, found {}", rest+1).as_slice());
cx.span_err(sp, &format!("expected 1 argument, found {}", rest+1));
}
base::DummyResult::expr(sp)
}

View file

@ -12,7 +12,7 @@
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
//! Use this for structs that correspond to a DOM type
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)]
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, unicode)]
#[macro_use]
extern crate syntax;

View file

@ -32,10 +32,10 @@ impl LintPass for TransmutePass {
&& args.len() == 1 {
let tcx = cx.tcx;
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
format!("Transmute to {} from {} detected",
&format!("Transmute to {} from {} detected",
expr_ty(tcx, ex).repr(tcx),
expr_ty(tcx, &**args.get(0).unwrap()).repr(tcx)
).as_slice());
));
}
}
_ => {}

View file

@ -150,7 +150,7 @@ impl LintPass for UnrootedPass {
ty::ty_enum(did, _) => {
if ty::has_attr(cx.tcx, did, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
format!("Expression of type {} must be rooted", t.repr(cx.tcx)).as_slice());
&format!("Expression of type {} must be rooted", t.repr(cx.tcx)));
}
}
_ => {}

View file

@ -22,9 +22,9 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
// however the more efficient way is to simply reverse the iterators and zip them
// which will compare them in reverse until one of them runs out of segments
if seg.iter().rev().zip(segments.iter().rev()).all(|(a,b)| a.identifier.as_str() == *b) {
match seg.as_slice().last() {
match seg.last() {
Some(&PathSegment {parameters: AngleBracketedParameters(ref a), ..}) => {
Some(a.types.as_slice())
Some(&a.types)
}
_ => None
}

View file

@ -592,7 +592,7 @@ mod system_reporter {
};
if looking_for == LookingFor::Segment {
// Look for a segment info line.
let cap = match seg_re.captures(line.as_slice()) {
let cap = match seg_re.captures(&line) {
Some(cap) => cap,
None => continue,
};
@ -617,7 +617,7 @@ mod system_reporter {
looking_for = LookingFor::Rss;
} else {
// Look for an "Rss:" line.
let cap = match rss_re.captures(line.as_slice()) {
let cap = match rss_re.captures(&line) {
Some(cap) => cap,
None => continue,
};

View file

@ -69,7 +69,7 @@ impl CORSRequest {
referer.port() == destination.port() {
return Ok(None); // Not cross-origin, proceed with a normal fetch
}
match destination.scheme.as_slice() {
match &*destination.scheme {
// TODO: If the request's same origin data url flag is set (which isn't the case for XHR)
// we can fetch a data URL normally. about:blank can also be fetched by XHR
"http" | "https" => {
@ -221,7 +221,7 @@ impl CORSRequest {
// Substeps 1-3 (parsing rules: https://fetch.spec.whatwg.org/#http-new-header-syntax)
let methods_substep4 = [self.method.clone()];
let mut methods = match response.headers.get() {
Some(&AccessControlAllowMethods(ref v)) => v.as_slice(),
Some(&AccessControlAllowMethods(ref v)) => &**v,
_ => return error
};
let headers = match response.headers.get() {
@ -420,7 +420,7 @@ impl CORSCache {
fn is_simple_header(h: &HeaderView) -> bool {
//FIXME: use h.is::<HeaderType>() when AcceptLanguage and
//ContentLanguage headers exist
match h.name().to_ascii_lowercase().as_slice() {
match &*h.name().to_ascii_lowercase() {
"accept" | "accept-language" | "content-language" => true,
"content-type" => match h.value() {
Some(&ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) |

View file

@ -1019,9 +1019,9 @@ pub mod longhands {
try!(dest.write_str(" "));
}
first = false;
try!(Token::QuotedString(pair.0.as_slice().into_cow()).to_css(dest));
try!(Token::QuotedString((*pair.0).into_cow()).to_css(dest));
try!(dest.write_str(" "));
try!(Token::QuotedString(pair.1.as_slice().into_cow()).to_css(dest));
try!(Token::QuotedString((*pair.1).into_cow()).to_css(dest));
}
Ok(())
}
@ -1381,12 +1381,10 @@ pub mod longhands {
if let Ok(value) = input.try(|input| {
match input.next() {
Err(_) => Err(()),
Ok(Token::Ident(ref ident)) if ident.as_slice()
.eq_ignore_ascii_case("cover") => {
Ok(Token::Ident(ref ident)) if ident.eq_ignore_ascii_case("cover") => {
Ok(SpecifiedValue::Cover)
}
Ok(Token::Ident(ref ident)) if ident.as_slice()
.eq_ignore_ascii_case("contain") => {
Ok(Token::Ident(ref ident)) if ident.eq_ignore_ascii_case("contain") => {
Ok(SpecifiedValue::Contain)
}
Ok(_) => Err(()),

View file

@ -888,7 +888,7 @@ pub mod specified {
pub fn parse(input: &mut Parser) -> Result<Time,()> {
match input.next() {
Ok(Token::Dimension(ref value, ref unit)) => {
Time::parse_dimension(value.value, unit.as_slice())
Time::parse_dimension(value.value, &unit)
}
_ => Err(()),
}

View file

@ -8,7 +8,7 @@ use string_cache::{Atom, Namespace};
pub fn from_domstring(url: Option<DOMString>) -> Namespace {
match url {
None => ns!(""),
Some(ref s) => Namespace(Atom::from_slice(s.as_slice())),
Some(ref s) => Namespace(Atom::from_slice(s)),
}
}

View file

@ -145,7 +145,7 @@ pub struct Opts {
fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
let message = format!("Usage: {} [ options ... ] [URL]\n\twhere options include", app);
println!("{}", getopts::usage(message.as_slice(), opts));
println!("{}", getopts::usage(&message, opts));
}
pub fn print_debug_usage(app: &str) {
@ -262,16 +262,16 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
getopts::optflag("", "sniff-mime-types" , "Enable MIME sniffing"),
);
let opt_match = match getopts::getopts(args, opts.as_slice()) {
let opt_match = match getopts::getopts(args, &opts) {
Ok(m) => m,
Err(f) => {
args_fail(f.to_string().as_slice());
args_fail(&f.to_string());
return false;
}
};
if opt_match.opt_present("h") || opt_match.opt_present("help") {
print_usage(app_name.as_slice(), opts.as_slice());
print_usage(&app_name, &opts);
return false;
};
@ -280,16 +280,16 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
None => String::new()
};
let mut debug_options = HashSet::new();
for split in debug_string.as_slice().split(',') {
for split in debug_string.split(',') {
debug_options.insert(split.clone());
}
if debug_options.contains(&"help") {
print_debug_usage(app_name.as_slice());
print_debug_usage(&app_name);
return false;
}
let url = if opt_match.free.is_empty() {
print_usage(app_name.as_slice(), opts.as_slice());
print_usage(&app_name, &opts);
args_fail("servo asks that you provide a URL");
return false;
} else {

View file

@ -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
}
}