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
This commit is contained in:
Corey Farwell 2015-03-29 13:33:02 -04:00
parent b8ea10bfe3
commit d838fcce30
19 changed files with 98 additions and 102 deletions

View file

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