From d838fcce30d56e02bd22c4bcfca04d39bf4fc38e Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 29 Mar 2015 13:33:02 -0400 Subject: Remove some unnecessary uses of `as_slice` For the majority of these cases, `as_slice` can be removed due to `Deref`. In particular, `Deref` for: * `String` -> `str` * `Atom` -> `str` The latter of those two requires, a bump of the locked `string-cache` library --- components/script/cors.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/script/cors.rs') diff --git a/components/script/cors.rs b/components/script/cors.rs index 6930848bb7c..c11f8233c4a 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -171,7 +171,7 @@ impl CORSRequest { }; // Substep 4 if methods.len() == 0 || preflight.mode == RequestMode::ForcedPreflight { - methods = methods_substep4.as_slice(); + methods = &methods_substep4; } // Substep 5 if !is_simple_method(&self.method) && @@ -183,7 +183,7 @@ impl CORSRequest { if is_simple_header(&h) { continue; } - if !headers.iter().any(|ref h2| h.name().eq_ignore_ascii_case(h2.as_slice())) { + if !headers.iter().any(|ref h2| h.name().eq_ignore_ascii_case(h2)) { return error; } } @@ -254,7 +254,7 @@ pub enum HeaderOrMethod { impl HeaderOrMethod { fn match_header(&self, header_name: &str) -> bool { match *self { - HeaderOrMethod::HeaderData(ref s) => s.as_slice().eq_ignore_ascii_case(header_name), + HeaderOrMethod::HeaderData(ref s) => s.eq_ignore_ascii_case(header_name), _ => false } } -- cgit v1.2.3