aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-04-19 09:19:31 -0400
committerCorey Farwell <coreyf@rwell.org>2016-04-19 19:36:12 -0400
commit4618ad6b73e046fc359e23ede2fd3531ff9f5997 (patch)
tree5595a76d59c5163fdd46191451c435125b3d7a03
parent64b0dafde8f65ef4aceeb85436c547a1581c619f (diff)
downloadservo-4618ad6b73e046fc359e23ede2fd3531ff9f5997.tar.gz
servo-4618ad6b73e046fc359e23ede2fd3531ff9f5997.zip
More idiomatic char retrieval from `String`.
-rw-r--r--components/net/cookie.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/net/cookie.rs b/components/net/cookie.rs
index 2f555767b11..0f77a8d6f2c 100644
--- a/components/net/cookie.rs
+++ b/components/net/cookie.rs
@@ -66,7 +66,7 @@ impl Cookie {
// Step 7
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 = url_path.as_ref().map(|path| &**path);
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
pub fn default_path(request_path: &str) -> &str {
// Step 2
- if request_path.is_empty() || !request_path.starts_with("/") {
+ if request_path.chars().next() != Some('/') {
return "/";
}