Skip to content

Commit 47da1dd

Browse files
committed
Upgrade to rustc 1.0.0-dev (a9be50e28 2015-01-09 19:44:50 +0000)
1 parent 3d32239 commit 47da1dd

File tree

7 files changed

+33
-28
lines changed

7 files changed

+33
-28
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "url"
4-
version = "0.2.14"
4+
version = "0.2.15"
55
authors = [ "Simon Sapin <[email protected]>" ]
66

77
description = "URL parser for Rust"

src/format.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
//!
1111
//! These formatters can be used to coerce various URL parts into strings.
1212
//!
13-
//! You can use `<formatter>.to_string()`, as the formatters implement `Show`.
13+
//! You can use `<formatter>.to_string()`, as the formatters implement `fmt::String`.
1414
15-
use std::fmt::{self, Show, Formatter};
15+
use std::fmt::{self, Formatter};
1616
use super::Url;
1717

1818
/// Formatter and serializer for URL path data.
@@ -21,7 +21,7 @@ pub struct PathFormatter<'a, T:'a> {
2121
pub path: &'a [T]
2222
}
2323

24-
impl<'a, T: Str + Show> Show for PathFormatter<'a, T> {
24+
impl<'a, T: Str + fmt::String> fmt::String for PathFormatter<'a, T> {
2525
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
2626
if self.path.is_empty() {
2727
formatter.write_str("/")
@@ -47,7 +47,7 @@ pub struct UserInfoFormatter<'a> {
4747
pub password: Option<&'a str>
4848
}
4949

50-
impl<'a> Show for UserInfoFormatter<'a> {
50+
impl<'a> fmt::String for UserInfoFormatter<'a> {
5151
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
5252
if !self.username.is_empty() || self.password.is_some() {
5353
try!(formatter.write_str(self.username));
@@ -70,7 +70,7 @@ pub struct UrlNoFragmentFormatter<'a> {
7070
pub url: &'a Url
7171
}
7272

73-
impl<'a> Show for UrlNoFragmentFormatter<'a> {
73+
impl<'a> fmt::String for UrlNoFragmentFormatter<'a> {
7474
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
7575
try!(formatter.write_str(self.url.scheme.as_slice()));
7676
try!(formatter.write_str(":"));

src/host.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
use std::ascii::{AsciiExt, OwnedAsciiExt};
1010
use std::cmp;
11-
use std::fmt::{self, Formatter, Show};
11+
use std::fmt::{self, Formatter};
1212
use parser::{ParseResult, ParseError};
1313
use percent_encoding::{from_hex, percent_decode};
1414

1515

1616
/// The host name of an URL.
17-
#[derive(PartialEq, Eq, Clone)]
17+
#[derive(PartialEq, Eq, Clone, Show)]
1818
pub enum Host {
1919
/// A (DNS) domain name or an IPv4 address.
2020
///
@@ -30,7 +30,7 @@ pub enum Host {
3030

3131

3232
/// A 128 bit IPv6 address
33-
#[derive(Clone, Eq, PartialEq, Copy)]
33+
#[derive(Clone, Eq, PartialEq, Copy, Show)]
3434
pub struct Ipv6Address {
3535
pub pieces: [u16; 8]
3636
}
@@ -77,7 +77,7 @@ impl Host {
7777
}
7878

7979

80-
impl Show for Host {
80+
impl fmt::String for Host {
8181
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
8282
match *self {
8383
Host::Domain(ref domain) => domain.fmt(formatter),
@@ -218,7 +218,7 @@ impl Ipv6Address {
218218
}
219219

220220

221-
impl Show for Ipv6Address {
221+
impl fmt::String for Ipv6Address {
222222
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
223223
let (compress_start, compress_end) = longest_zero_sequence(&self.pieces);
224224
let mut i = 0;

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ assert!(css_url.serialize() == "http://servo.github.io/rust-url/main.css".to_str
121121

122122
extern crate "rustc-serialize" as rustc_serialize;
123123

124-
use std::fmt::{self, Formatter, Show};
124+
use std::fmt::{self, Formatter};
125125
use std::hash;
126126
use std::path;
127127

@@ -153,7 +153,7 @@ mod tests;
153153

154154

155155
/// The parsed representation of an absolute URL.
156-
#[derive(PartialEq, Eq, Clone)]
156+
#[derive(PartialEq, Eq, Clone, Show)]
157157
pub struct Url {
158158
/// The scheme (a.k.a. protocol) of the URL, in ASCII lower case.
159159
pub scheme: String,
@@ -184,7 +184,7 @@ pub struct Url {
184184
}
185185

186186
/// The components of the URL whose representation depends on where the scheme is *relative*.
187-
#[derive(PartialEq, Eq, Clone)]
187+
#[derive(PartialEq, Eq, Clone, Show)]
188188
pub enum SchemeData {
189189
/// Components for URLs in a *relative* scheme such as HTTP.
190190
Relative(RelativeSchemeData),
@@ -198,7 +198,7 @@ pub enum SchemeData {
198198
}
199199

200200
/// Components for URLs in a *relative* scheme such as HTTP.
201-
#[derive(PartialEq, Eq, Clone)]
201+
#[derive(PartialEq, Eq, Clone, Show)]
202202
pub struct RelativeSchemeData {
203203
/// The username of the URL, as a possibly empty, pecent-encoded string.
204204
///
@@ -237,8 +237,8 @@ pub struct RelativeSchemeData {
237237
pub path: Vec<String>,
238238
}
239239

240-
impl<S: hash::Writer> hash::Hash<S> for Url {
241-
fn hash(&self, state: &mut S) {
240+
impl<H: hash::Hasher + hash::Writer> hash::Hash<H> for Url {
241+
fn hash(&self, state: &mut H) {
242242
self.serialize().hash(state)
243243
}
244244
}
@@ -401,7 +401,7 @@ impl<'a> UrlParser<'a> {
401401

402402

403403
/// Determines the behavior of the URL parser for a given scheme.
404-
#[derive(PartialEq, Eq, Copy)]
404+
#[derive(PartialEq, Eq, Copy, Show)]
405405
pub enum SchemeType {
406406
/// Indicate that the scheme is *non-relative*.
407407
///
@@ -764,7 +764,7 @@ impl rustc_serialize::Decodable for Url {
764764
}
765765

766766

767-
impl Show for Url {
767+
impl fmt::String for Url {
768768
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
769769
try!(UrlNoFragmentFormatter{ url: self }.fmt(formatter));
770770
match self.fragment {
@@ -779,7 +779,7 @@ impl Show for Url {
779779
}
780780

781781

782-
impl Show for SchemeData {
782+
impl fmt::String for SchemeData {
783783
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
784784
match *self {
785785
SchemeData::Relative(ref scheme_data) => scheme_data.fmt(formatter),
@@ -884,7 +884,7 @@ impl RelativeSchemeData {
884884
}
885885

886886

887-
impl Show for RelativeSchemeData {
887+
impl fmt::String for RelativeSchemeData {
888888
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
889889
// Write the scheme-trailing double slashes.
890890
try!(formatter.write_str("//"));

src/parser.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use std::ascii::AsciiExt;
1010
use std::error::Error;
11-
use std::fmt::{self, Formatter, Show};
11+
use std::fmt::{self, Formatter};
1212
use std::str::CharRange;
1313

1414
use super::{UrlParser, Url, SchemeData, RelativeSchemeData, Host, SchemeType};
@@ -18,9 +18,14 @@ use percent_encoding::{
1818
};
1919

2020

21+
/// Work around "error: unexpected token: `an interpolated tt`", whatever that means.
22+
macro_rules! _tt_as_expr_hack(
23+
($value:expr) => ($value)
24+
);
25+
2126
macro_rules! is_match(
22-
($value:expr, $($pattern:pat)|+) => (
23-
match $value { $($pattern)|+ => true, _ => false }
27+
($value:expr, $($pattern:tt)+) => (
28+
_tt_as_expr_hack!( match $value { $($pattern)+ => true, _ => false })
2429
);
2530
);
2631

@@ -31,7 +36,7 @@ pub type ParseResult<T> = Result<T, ParseError>;
3136
macro_rules! simple_enum_error {
3237
($($name: ident => $description: expr,)+) => {
3338
/// Errors that can occur during parsing.
34-
#[derive(PartialEq, Eq, Clone, Copy)]
39+
#[derive(PartialEq, Eq, Clone, Copy, Show)]
3540
pub enum ParseError {
3641
$(
3742
$name,
@@ -77,7 +82,7 @@ simple_enum_error! {
7782
CannotSetPathWithNonRelativeScheme => "cannot set path with non-relative scheme",
7883
}
7984

80-
impl Show for ParseError {
85+
impl fmt::String for ParseError {
8186
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
8287
self.description().fmt(fmt)
8388
}

src/punycode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ mod tests {
261261
_ => panic!(),
262262
}
263263
},
264-
other => panic!("{}", other)
264+
other => panic!("{:?}", other)
265265
}
266266
}
267267
}

src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn url_parsing() {
6060
if expected_failure {
6161
continue
6262
} else {
63-
panic!("{} != {}", a, b)
63+
panic!("{:?} != {:?}", a, b)
6464
}
6565
}
6666
}

0 commit comments

Comments
 (0)