From a0737d32321c11e1d4c6e5b4874e0ba3e381fcd1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 7 Jul 2014 06:41:43 -0700 Subject: [PATCH] Update to master --- src/lib/lib.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/lib/lib.rs b/src/lib/lib.rs index ceca44fd..ee1a55b7 100644 --- a/src/lib/lib.rs +++ b/src/lib/lib.rs @@ -51,7 +51,7 @@ //! } //! ``` -#![crate_id="github.com/sfackler/rust-postgres#postgres:0.0"] +#![crate_name="postgres"] #![crate_type="rlib"] #![crate_type="dylib"] #![doc(html_root_url="http://www.rust-ci.org/sfackler/rust-postgres/doc")] @@ -207,7 +207,7 @@ impl IntoConnectParams for PostgresConnectParams { impl<'a> IntoConnectParams for &'a str { fn into_connect_params(self) -> Result { - match url::from_str(self) { + match Url::parse(self) { Ok(url) => url.into_connect_params(), Err(err) => return Err(InvalidUrl(err)), } @@ -221,12 +221,14 @@ impl IntoConnectParams for Url { host, port, user, - path, - query: options, + path: url::Path { path, query: options, .. }, .. } = self; - let maybe_path = url::decode_component(host.as_slice()); + let maybe_path = match url::decode_component(host.as_slice()) { + Ok(path) => path, + Err(err) => return Err(InvalidUrl(err)), + }; let target = if maybe_path.as_slice().starts_with("/") { TargetUnix(Path::new(maybe_path)) } else { @@ -238,14 +240,6 @@ impl IntoConnectParams for Url { None => (None, None), }; - let port = match port { - Some(port) => match FromStr::from_str(port.as_slice()) { - Some(port) => Some(port), - None => return Err(InvalidUrl("invalid port".to_str())), - }, - None => None, - }; - let database = if !path.is_empty() { // path contains the leading / let (_, path) = path.as_slice().slice_shift_char();