5151//! }
5252//! ```
5353
54- #![ crate_id= "github.com/sfackler/rust- postgres#postgres:0.0 "]
54+ #![ crate_name= " postgres"]
5555#![ crate_type="rlib" ]
5656#![ crate_type="dylib" ]
5757#![ doc( html_root_url="http://www.rust-ci.org/sfackler/rust-postgres/doc" ) ]
@@ -207,7 +207,7 @@ impl IntoConnectParams for PostgresConnectParams {
207207impl < ' a > IntoConnectParams for & ' a str {
208208 fn into_connect_params ( self ) -> Result < PostgresConnectParams ,
209209 PostgresConnectError > {
210- match url :: from_str ( self ) {
210+ match Url :: parse ( self ) {
211211 Ok ( url) => url. into_connect_params ( ) ,
212212 Err ( err) => return Err ( InvalidUrl ( err) ) ,
213213 }
@@ -221,12 +221,14 @@ impl IntoConnectParams for Url {
221221 host,
222222 port,
223223 user,
224- path,
225- query : options,
224+ path : url:: Path { path, query : options, .. } ,
226225 ..
227226 } = self ;
228227
229- let maybe_path = url:: decode_component ( host. as_slice ( ) ) ;
228+ let maybe_path = match url:: decode_component ( host. as_slice ( ) ) {
229+ Ok ( path) => path,
230+ Err ( err) => return Err ( InvalidUrl ( err) ) ,
231+ } ;
230232 let target = if maybe_path. as_slice ( ) . starts_with ( "/" ) {
231233 TargetUnix ( Path :: new ( maybe_path) )
232234 } else {
@@ -238,14 +240,6 @@ impl IntoConnectParams for Url {
238240 None => ( None , None ) ,
239241 } ;
240242
241- let port = match port {
242- Some ( port) => match FromStr :: from_str ( port. as_slice ( ) ) {
243- Some ( port) => Some ( port) ,
244- None => return Err ( InvalidUrl ( "invalid port" . to_str ( ) ) ) ,
245- } ,
246- None => None ,
247- } ;
248-
249243 let database = if !path. is_empty ( ) {
250244 // path contains the leading /
251245 let ( _, path) = path. as_slice ( ) . slice_shift_char ( ) ;
0 commit comments