fix(rustup): rustc 1.0.0-nightly (123a754cb 2015-03-24)
* fix `extern crate` declaration for rustc-serialize * enable `into_cow` feature * replace as_slice() calls by as_ref and enable `convert` feature * use `core` feature in doc tests
This commit is contained in:
@@ -39,7 +39,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_parse_header_no_quality() {
|
||||
let a: Accept = Header::parse_header([b"text/plain; charset=utf-8".to_vec()].as_slice()).unwrap();
|
||||
let a: Accept = Header::parse_header([b"text/plain; charset=utf-8".to_vec()].as_ref()).unwrap();
|
||||
let b = Accept(vec![
|
||||
qitem(Mime(TopLevel::Text, SubLevel::Plain, vec![(Attr::Charset, Value::Utf8)])),
|
||||
]);
|
||||
@@ -48,7 +48,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_parse_header_with_quality() {
|
||||
let a: Accept = Header::parse_header([b"text/plain; charset=utf-8; q=0.5".to_vec()].as_slice()).unwrap();
|
||||
let a: Accept = Header::parse_header([b"text/plain; charset=utf-8; q=0.5".to_vec()].as_ref()).unwrap();
|
||||
let b = Accept(vec![
|
||||
QualityItem::new(Mime(TopLevel::Text, SubLevel::Plain, vec![(Attr::Charset, Value::Utf8)]), Quality(500)),
|
||||
]);
|
||||
|
||||
@@ -16,7 +16,7 @@ impl_list_header!(AcceptCharset,
|
||||
fn test_parse_header() {
|
||||
use header::{self, q};
|
||||
let a: AcceptCharset = header::Header::parse_header(
|
||||
[b"iso-8859-5, iso-8859-6;q=0.8".to_vec()].as_slice()).unwrap();
|
||||
[b"iso-8859-5, iso-8859-6;q=0.8".to_vec()].as_ref()).unwrap();
|
||||
let b = AcceptCharset(vec![
|
||||
QualityItem { item: Charset::Iso_8859_5, quality: q(1.0) },
|
||||
QualityItem { item: Charset::Iso_8859_6, quality: q(0.8) },
|
||||
|
||||
@@ -19,7 +19,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_parse_header() {
|
||||
let a: AcceptEncoding = Header::parse_header([b"gzip;q=1.0, identity; q=0.5".to_vec()].as_slice()).unwrap();
|
||||
let a: AcceptEncoding = Header::parse_header([b"gzip;q=1.0, identity; q=0.5".to_vec()].as_ref()).unwrap();
|
||||
let b = AcceptEncoding(vec![
|
||||
qitem(Encoding::Gzip),
|
||||
QualityItem::new(Encoding::Identity, Quality(500)),
|
||||
|
||||
@@ -54,7 +54,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_parse_header() {
|
||||
let a: AcceptLanguage = Header::parse_header(
|
||||
[b"en-us;q=1.0, en;q=0.5, fr".to_vec()].as_slice()).unwrap();
|
||||
[b"en-us;q=1.0, en;q=0.5, fr".to_vec()].as_ref()).unwrap();
|
||||
let b = AcceptLanguage(vec![
|
||||
qitem(Language{primary: "en".to_string(), sub: Some("us".to_string())}),
|
||||
QualityItem::new(Language{primary: "en".to_string(), sub: None},
|
||||
|
||||
@@ -27,6 +27,6 @@ impl header::Header for AccessControlAllowHeaders {
|
||||
impl header::HeaderFormat for AccessControlAllowHeaders {
|
||||
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let AccessControlAllowHeaders(ref parts) = *self;
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_slice())
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ impl header::Header for AccessControlAllowMethods {
|
||||
impl header::HeaderFormat for AccessControlAllowMethods {
|
||||
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let AccessControlAllowMethods(ref parts) = *self;
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_slice())
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ impl header::Header for AccessControlRequestHeaders {
|
||||
impl header::HeaderFormat for AccessControlRequestHeaders {
|
||||
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let AccessControlRequestHeaders(ref parts) = *self;
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_slice())
|
||||
header::parsing::fmt_comma_delimited(f, parts.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ mod tests {
|
||||
fn test_allow() {
|
||||
let mut allow: Option<Allow>;
|
||||
|
||||
allow = Header::parse_header([b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()].as_slice());
|
||||
allow = Header::parse_header([b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()].as_ref());
|
||||
assert_eq!(allow, Some(Allow(vec![Options, Get, Put, Post, Delete, Head, Trace, Connect, Patch, Extension("fOObAr".to_string())])));
|
||||
|
||||
allow = Header::parse_header([b"".to_vec()].as_slice());
|
||||
allow = Header::parse_header([b"".to_vec()].as_ref());
|
||||
assert_eq!(allow, Some(Allow(Vec::<Method>::new())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ impl fmt::Display for ConnectionOption {
|
||||
write!(fmt, "{}", match *self {
|
||||
KeepAlive => "keep-alive",
|
||||
Close => "close",
|
||||
ConnectionHeader(UniCase(ref s)) => s.as_slice()
|
||||
ConnectionHeader(UniCase(ref s)) => s.as_ref()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,31 +45,31 @@ mod tests {
|
||||
// Expected successes
|
||||
let mut etag: Option<Etag>;
|
||||
|
||||
etag = Header::parse_header([b"\"foobar\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"\"foobar\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, Some(Etag(EntityTag{
|
||||
weak: false,
|
||||
tag: "foobar".to_string()
|
||||
})));
|
||||
|
||||
etag = Header::parse_header([b"\"\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"\"\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, Some(Etag(EntityTag{
|
||||
weak: false,
|
||||
tag: "".to_string()
|
||||
})));
|
||||
|
||||
etag = Header::parse_header([b"W/\"weak-etag\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"W/\"weak-etag\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, Some(Etag(EntityTag{
|
||||
weak: true,
|
||||
tag: "weak-etag".to_string()
|
||||
})));
|
||||
|
||||
etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, Some(Etag(EntityTag{
|
||||
weak: true,
|
||||
tag: "\u{0065}\u{0062}".to_string()
|
||||
})));
|
||||
|
||||
etag = Header::parse_header([b"W/\"\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"W/\"\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, Some(Etag(EntityTag{
|
||||
weak: true,
|
||||
tag: "".to_string()
|
||||
@@ -81,22 +81,22 @@ mod tests {
|
||||
// Expected failures
|
||||
let mut etag: Option<Etag>;
|
||||
|
||||
etag = Header::parse_header([b"no-dquotes".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"no-dquotes".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
|
||||
etag = Header::parse_header([b"w/\"the-first-w-is-case-sensitive\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"w/\"the-first-w-is-case-sensitive\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
|
||||
etag = Header::parse_header([b"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
|
||||
etag = Header::parse_header([b"\"unmatched-dquotes1".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"\"unmatched-dquotes1".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
|
||||
etag = Header::parse_header([b"unmatched-dquotes2\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"unmatched-dquotes2\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
|
||||
etag = Header::parse_header([b"matched-\"dquotes\"".to_vec()].as_slice());
|
||||
etag = Header::parse_header([b"matched-\"dquotes\"".to_vec()].as_ref());
|
||||
assert_eq!(etag, None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,14 +81,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_host() {
|
||||
let host = Header::parse_header([b"foo.com".to_vec()].as_slice());
|
||||
let host = Header::parse_header([b"foo.com".to_vec()].as_ref());
|
||||
assert_eq!(host, Some(Host {
|
||||
hostname: "foo.com".to_string(),
|
||||
port: None
|
||||
}));
|
||||
|
||||
|
||||
let host = Header::parse_header([b"foo.com:8080".to_vec()].as_slice());
|
||||
let host = Header::parse_header([b"foo.com:8080".to_vec()].as_ref());
|
||||
assert_eq!(host, Some(Host {
|
||||
hostname: "foo.com".to_string(),
|
||||
port: Some(8080)
|
||||
|
||||
@@ -48,12 +48,12 @@ impl HeaderFormat for IfMatch {
|
||||
fn test_parse_header() {
|
||||
{
|
||||
let a: IfMatch = Header::parse_header(
|
||||
[b"*".to_vec()].as_slice()).unwrap();
|
||||
[b"*".to_vec()].as_ref()).unwrap();
|
||||
assert_eq!(a, IfMatch::Any);
|
||||
}
|
||||
{
|
||||
let a: IfMatch = Header::parse_header(
|
||||
[b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"".to_vec()].as_slice()).unwrap();
|
||||
[b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"".to_vec()].as_ref()).unwrap();
|
||||
let b = IfMatch::EntityTags(
|
||||
vec![EntityTag{weak:false, tag: "xyzzy".to_string()},
|
||||
EntityTag{weak:false, tag: "r2d2xxxx".to_string()},
|
||||
|
||||
@@ -62,10 +62,10 @@ mod tests {
|
||||
fn test_if_none_match() {
|
||||
let mut if_none_match: Option<IfNoneMatch>;
|
||||
|
||||
if_none_match = Header::parse_header([b"*".to_vec()].as_slice());
|
||||
if_none_match = Header::parse_header([b"*".to_vec()].as_ref());
|
||||
assert_eq!(if_none_match, Some(IfNoneMatch::Any));
|
||||
|
||||
if_none_match = Header::parse_header([b"\"foobar\", W/\"weak-etag\"".to_vec()].as_slice());
|
||||
if_none_match = Header::parse_header([b"\"foobar\", W/\"weak-etag\"".to_vec()].as_ref());
|
||||
let mut entities: Vec<EntityTag> = Vec::new();
|
||||
let foobar_etag = EntityTag {
|
||||
weak: false,
|
||||
|
||||
@@ -52,10 +52,10 @@ impl HeaderFormat for Pragma {
|
||||
|
||||
#[test]
|
||||
fn test_parse_header() {
|
||||
let a: Pragma = Header::parse_header([b"no-cache".to_vec()].as_slice()).unwrap();
|
||||
let a: Pragma = Header::parse_header([b"no-cache".to_vec()].as_ref()).unwrap();
|
||||
let b = Pragma::NoCache;
|
||||
assert_eq!(a, b);
|
||||
let c: Pragma = Header::parse_header([b"FoObar".to_vec()].as_slice()).unwrap();
|
||||
let c: Pragma = Header::parse_header([b"FoObar".to_vec()].as_ref()).unwrap();
|
||||
let d = Pragma::Ext("FoObar".to_string());
|
||||
assert_eq!(c, d);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ impl fmt::Display for Protocol {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", match *self {
|
||||
WebSocket => "websocket",
|
||||
ProtocolExt(ref s) => s.as_slice()
|
||||
ProtocolExt(ref s) => s.as_ref()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ mod tests {
|
||||
fn test_vary() {
|
||||
let mut vary: Option<Vary>;
|
||||
|
||||
vary = Header::parse_header([b"*".to_vec()].as_slice());
|
||||
vary = Header::parse_header([b"*".to_vec()].as_ref());
|
||||
assert_eq!(vary, Some(Vary::Any));
|
||||
|
||||
vary = Header::parse_header([b"etag,cookie,allow".to_vec()].as_slice());
|
||||
vary = Header::parse_header([b"etag,cookie,allow".to_vec()].as_ref());
|
||||
assert_eq!(vary, Some(Vary::Headers(vec!["eTag".parse().unwrap(),
|
||||
"cookIE".parse().unwrap(),
|
||||
"AlLOw".parse().unwrap(),])));
|
||||
|
||||
Reference in New Issue
Block a user