We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 369cb1b commit 26ec854Copy full SHA for 26ec854
1 file changed
src/lib.rs
@@ -170,7 +170,7 @@ impl IntoConnectParams for Url {
170
host,
171
port,
172
user,
173
- path: url::Path { path, query: options, .. },
+ path: url::Path { mut path, query: options, .. },
174
..
175
} = self;
176
@@ -195,8 +195,13 @@ impl IntoConnectParams for Url {
195
UserInfo { user: user, password: pass }
196
});
197
198
- // path contains the leading /
199
- let database = path.slice_shift_char().map(|(_, path)| path.to_owned());
+ let database = if path.is_empty() {
+ None
200
+ } else {
201
+ // path contains the leading /
202
+ path.remove(0);
203
+ Some(path)
204
+ };
205
206
Ok(ConnectParams {
207
target: target,
0 commit comments