mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
More idiomatic char retrieval from String
.
This commit is contained in:
parent
64b0dafde8
commit
4618ad6b73
1 changed files with 2 additions and 2 deletions
|
@ -66,7 +66,7 @@ impl Cookie {
|
||||||
|
|
||||||
// Step 7
|
// Step 7
|
||||||
let mut path = cookie.path.unwrap_or("".to_owned());
|
let mut path = cookie.path.unwrap_or("".to_owned());
|
||||||
if path.is_empty() || path.as_bytes()[0] != b'/' {
|
if path.chars().next() != Some('/') {
|
||||||
let url_path = request.serialize_path();
|
let url_path = request.serialize_path();
|
||||||
let url_path = url_path.as_ref().map(|path| &**path);
|
let url_path = url_path.as_ref().map(|path| &**path);
|
||||||
path = Cookie::default_path(url_path.unwrap_or("")).to_owned();
|
path = Cookie::default_path(url_path.unwrap_or("")).to_owned();
|
||||||
|
@ -96,7 +96,7 @@ impl Cookie {
|
||||||
// http://tools.ietf.org/html/rfc6265#section-5.1.4
|
// http://tools.ietf.org/html/rfc6265#section-5.1.4
|
||||||
pub fn default_path(request_path: &str) -> &str {
|
pub fn default_path(request_path: &str) -> &str {
|
||||||
// Step 2
|
// Step 2
|
||||||
if request_path.is_empty() || !request_path.starts_with("/") {
|
if request_path.chars().next() != Some('/') {
|
||||||
return "/";
|
return "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue