Skip to content

Commit 85bde64

Browse files
committed
slice_shift_char signature change
1 parent 0b8dc31 commit 85bde64

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,8 @@ impl IntoConnectParams for Url {
181181
UserInfo { user: user, password: pass }
182182
});
183183

184-
let database = if !path.is_empty() {
185-
// path contains the leading /
186-
let (_, path) = path[].slice_shift_char();
187-
Some(path.into_string())
188-
} else {
189-
Option::None
190-
};
184+
// path contains the leading /
185+
let database = path.slice_shift_char().map(|(_, path)| path.into_string());
191186

192187
Ok(ConnectParams {
193188
target: target,

src/url.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ fn get_query_fragment(rawurl: &str) -> DecodeResult<(Query, Option<String>)> {
463463
};
464464

465465
match before_fragment.slice_shift_char() {
466-
(Some('?'), rest) => Ok((try!(query_from_str(rest)), fragment)),
467-
(None, "") => Ok((vec!(), fragment)),
466+
Some(('?', rest)) => Ok((try!(query_from_str(rest)), fragment)),
467+
None => Ok((vec!(), fragment)),
468468
_ => Err(format!("Query didn't start with '?': '{}..'", before_fragment)),
469469
}
470470
}

0 commit comments

Comments
 (0)