From 8bb5f0420b528a2441122dfeaef288e30efb1671 Mon Sep 17 00:00:00 2001 From: Till Hoeppner Date: Mon, 24 Nov 2014 20:00:31 +0100 Subject: [PATCH] Fix for ASCII_LOWER_MAP visibility and deprecation warnings --- src/header/mod.rs | 6 +++--- src/http.rs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/header/mod.rs b/src/header/mod.rs index d2e7a3f1..8a4e28c0 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -5,7 +5,7 @@ //! must implement the `Header` trait from this module. Several common headers //! are already provided, such as `Host`, `ContentType`, `UserAgent`, and others. use std::any::Any; -use std::ascii::{AsciiExt, ASCII_LOWER_MAP}; +use std::ascii::{AsciiExt, AsciiCast}; use std::fmt::{mod, Show}; use std::intrinsics::TypeId; use std::raw::TraitObject; @@ -417,8 +417,8 @@ impl Equiv> for CaseInsensitive { impl hash::Hash for CaseInsensitive { #[inline] fn hash(&self, hasher: &mut H) { - for byte in self.as_slice().bytes() { - hasher.write([ASCII_LOWER_MAP[byte as uint]].as_slice()); + for b in self.as_slice().bytes() { + hasher.write(&[b.to_ascii().to_lowercase().as_byte()]) } } } diff --git a/src/http.rs b/src/http.rs index bc599e2e..ac68508a 100644 --- a/src/http.rs +++ b/src/http.rs @@ -358,9 +358,8 @@ pub fn read_method(stream: &mut R) -> HttpResult { match (maybe_method, buf[]) { (Some(method), _) => Ok(method), (None, ext) => { - use std::str::raw; // We already checked that the buffer is ASCII - Ok(method::Method::Extension(unsafe { raw::from_utf8(ext) }.trim().into_string())) + Ok(method::Method::Extension(unsafe { str::from_utf8_unchecked(ext) }.trim().into_string())) }, } }