Remove use of type_ascription feature.

This commit is contained in:
Sergio Benitez 2017-05-20 11:51:17 -07:00
parent 6c00d362c0
commit d93d366ce7
3 changed files with 24 additions and 25 deletions

View File

@ -200,7 +200,7 @@ impl<'h> HeaderMap<'h> {
#[inline]
pub fn get<'a>(&'a self, name: &str) -> impl Iterator<Item=&'a str> {
self.headers
.get(name.into() : &UncasedStr)
.get(UncasedStr::new(name))
.into_iter()
.flat_map(|values| values.iter().map(|val| val.borrow()))
}
@ -238,7 +238,7 @@ impl<'h> HeaderMap<'h> {
/// ```
#[inline]
pub fn get_one<'a>(&'a self, name: &str) -> Option<&'a str> {
self.headers.get(name.into() : &UncasedStr)
self.headers.get(UncasedStr::new(name))
.and_then(|values| {
if values.len() >= 1 { Some(values[0].borrow()) }
else { None }
@ -428,7 +428,7 @@ impl<'h> HeaderMap<'h> {
/// assert_eq!(map.len(), 1);
#[inline(always)]
pub fn remove(&mut self, name: &str) {
self.headers.remove(name.into() : &UncasedStr);
self.headers.remove(UncasedStr::new(name));
}
/// Removes all of the headers stored in this map and returns a vector

View File

@ -3,7 +3,6 @@
#![feature(drop_types_in_const)]
#![feature(associated_consts)]
#![feature(const_fn)]
#![feature(type_ascription)]
#![feature(lookup_host)]
#![feature(plugin)]
#![feature(never_type)]

View File

@ -238,31 +238,31 @@ mod test {
use super::FormItems;
macro_rules! check_form {
(@opt $string:expr, $expected:expr) => ({
let mut items = FormItems::from($string);
let results: Vec<_> = items.by_ref().collect();
if let Some(expected) = $expected {
assert_eq!(expected.len(), results.len());
(@bad $string:expr) => (check_form($string, None));
($string:expr, $expected:expr) => (check_form($string, Some($expected)));
}
for i in 0..results.len() {
let (expected_key, actual_key) = (expected[i].0, results[i].0);
let (expected_val, actual_val) = (expected[i].1, results[i].1);
fn check_form(string: &str, expected: Option<&[(&str, &str)]>) {
let mut items = FormItems::from(string);
let results: Vec<_> = items.by_ref().collect();
if let Some(expected) = expected {
assert_eq!(expected.len(), results.len());
assert!(actual_key == expected_key,
"key [{}] mismatch: expected {}, got {}",
i, expected_key, actual_key);
for i in 0..results.len() {
let (expected_key, actual_key) = (expected[i].0, results[i].0);
let (expected_val, actual_val) = (expected[i].1, results[i].1);
assert!(actual_val == expected_val,
"val [{}] mismatch: expected {}, got {}",
i, expected_val, actual_val);
}
} else {
assert!(!items.exhaust());
assert!(actual_key == expected_key,
"key [{}] mismatch: expected {}, got {}",
i, expected_key, actual_key);
assert!(actual_val == expected_val,
"val [{}] mismatch: expected {}, got {}",
i, expected_val, actual_val);
}
});
(@bad $string:expr) => (check_form!(@opt $string, None : Option<&[(&str, &str)]>));
($string:expr, $expected:expr) => (check_form!(@opt $string, Some($expected)));
} else {
assert!(!items.exhaust());
}
}
#[test]