aboutsummaryrefslogtreecommitdiffstats
path: root/components/net
diff options
context:
space:
mode:
Diffstat (limited to 'components/net')
-rw-r--r--components/net/fetch/methods.rs2
-rw-r--r--components/net/http_cache.rs2
-rw-r--r--components/net/tests/cookie.rs34
-rw-r--r--components/net/tests/fetch.rs6
-rw-r--r--components/net/tests/hsts.rs6
5 files changed, 25 insertions, 25 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index 69999d381cc..667b46090c7 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -442,7 +442,7 @@ fn wait_for_response(response: &mut Response, target: Target, done_chan: &mut Do
// We should still send the body across as a chunk
target.process_response_chunk(vec.clone());
} else {
- assert!(*body == ResponseBody::Empty)
+ assert_eq!(*body, ResponseBody::Empty)
}
}
}
diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs
index 219a627314c..12fac0ae852 100644
--- a/components/net/http_cache.rs
+++ b/components/net/http_cache.rs
@@ -585,7 +585,7 @@ impl HttpCache {
/// Freshening Stored Responses upon Validation.
/// <https://tools.ietf.org/html/rfc7234#section-4.3.4>
pub fn refresh(&mut self, request: &Request, response: Response, done_chan: &mut DoneChannel) -> Option<Response> {
- assert!(response.status == Some(StatusCode::NotModified));
+ assert_eq!(response.status, Some(StatusCode::NotModified));
let entry_key = CacheKey::new(request.clone());
if let Some(cached_resources) = self.entries.get_mut(&entry_key) {
for cached_resource in cached_resources.iter_mut() {
diff --git a/components/net/tests/cookie.rs b/components/net/tests/cookie.rs
index 0508f5ae4ec..68149736680 100644
--- a/components/net/tests/cookie.rs
+++ b/components/net/tests/cookie.rs
@@ -44,13 +44,13 @@ fn test_path_match() {
#[test]
fn test_default_path() {
- assert!(&*Cookie::default_path("/foo/bar/baz/") == "/foo/bar/baz");
- assert!(&*Cookie::default_path("/foo/bar/baz") == "/foo/bar");
- assert!(&*Cookie::default_path("/foo/") == "/foo");
- assert!(&*Cookie::default_path("/foo") == "/");
- assert!(&*Cookie::default_path("/") == "/");
- assert!(&*Cookie::default_path("") == "/");
- assert!(&*Cookie::default_path("foo") == "/");
+ assert_eq!(&*Cookie::default_path("/foo/bar/baz/"), "/foo/bar/baz");
+ assert_eq!(&*Cookie::default_path("/foo/bar/baz"), "/foo/bar");
+ assert_eq!(&*Cookie::default_path("/foo/"), "/foo");
+ assert_eq!(&*Cookie::default_path("/foo"), "/");
+ assert_eq!(&*Cookie::default_path("/"), "/");
+ assert_eq!(&*Cookie::default_path(""), "/");
+ assert_eq!(&*Cookie::default_path("foo"), "/");
}
#[test]
@@ -69,7 +69,7 @@ fn fn_cookie_constructor() {
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = ").unwrap();
assert!(Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_some());
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
- assert!(&**cookie.cookie.domain().as_ref().unwrap() == "example.com");
+ assert_eq!(&**cookie.cookie.domain().as_ref().unwrap(), "example.com");
// cookie public domains test
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = gov.ac").unwrap();
@@ -88,11 +88,11 @@ fn fn_cookie_constructor() {
let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
- assert!(cookie.cookie.value() == "bar");
- assert!(cookie.cookie.name() == "baz");
+ assert_eq!(cookie.cookie.value(), "bar");
+ assert_eq!(cookie.cookie.name(), "baz");
assert!(cookie.cookie.secure());
- assert!(&cookie.cookie.path().as_ref().unwrap()[..] == "/foo/bar/");
- assert!(&cookie.cookie.domain().as_ref().unwrap()[..] == "example.com");
+ assert_eq!(&cookie.cookie.path().as_ref().unwrap()[..], "/foo/bar/");
+ assert_eq!(&cookie.cookie.domain().as_ref().unwrap()[..], "example.com");
assert!(cookie.host_only);
let u = &ServoUrl::parse("http://example.com/foobar").unwrap();
@@ -192,11 +192,11 @@ fn test_sort_order() {
let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
assert!(b.cookie.path().as_ref().unwrap().len() > a.cookie.path().as_ref().unwrap().len());
- assert!(CookieStorage::cookie_comparator(&a, &b) == Ordering::Greater);
- assert!(CookieStorage::cookie_comparator(&b, &a) == Ordering::Less);
- assert!(CookieStorage::cookie_comparator(&a, &a_prime) == Ordering::Less);
- assert!(CookieStorage::cookie_comparator(&a_prime, &a) == Ordering::Greater);
- assert!(CookieStorage::cookie_comparator(&a, &a) == Ordering::Equal);
+ assert_eq!(CookieStorage::cookie_comparator(&a, &b), Ordering::Greater);
+ assert_eq!(CookieStorage::cookie_comparator(&b, &a), Ordering::Less);
+ assert_eq!(CookieStorage::cookie_comparator(&a, &a_prime), Ordering::Less);
+ assert_eq!(CookieStorage::cookie_comparator(&a_prime, &a), Ordering::Greater);
+ assert_eq!(CookieStorage::cookie_comparator(&a, &a), Ordering::Equal);
}
fn add_cookie_to_storage(storage: &mut CookieStorage, url: &ServoUrl, cookie_str: &str)
diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs
index 02ae6d0e6e5..e2ac5e6f313 100644
--- a/components/net/tests/fetch.rs
+++ b/components/net/tests/fetch.rs
@@ -74,7 +74,7 @@ fn test_fetch_on_bad_port_is_network_error() {
let fetch_response = fetch(&mut request, None);
assert!(fetch_response.is_network_error());
let fetch_error = fetch_response.get_network_error().unwrap();
- assert!(fetch_error == &NetworkError::Internal("Request attempted on bad port".into()))
+ assert_eq!(fetch_error, &NetworkError::Internal("Request attempted on bad port".into()))
}
#[test]
@@ -110,7 +110,7 @@ fn test_fetch_aboutblank() {
request.referrer = Referrer::NoReferrer;
let fetch_response = fetch(&mut request, None);
assert!(!fetch_response.is_network_error());
- assert!(*fetch_response.body.lock().unwrap() == ResponseBody::Done(vec![]));
+ assert_eq!(*fetch_response.body.lock().unwrap(), ResponseBody::Done(vec![]));
}
#[test]
@@ -166,7 +166,7 @@ fn test_fetch_file() {
assert!(!fetch_response.is_network_error());
assert_eq!(fetch_response.headers.len(), 1);
let content_type: &ContentType = fetch_response.headers.get().unwrap();
- assert!(**content_type == Mime(TopLevel::Text, SubLevel::Css, vec![]));
+ assert_eq!(**content_type, Mime(TopLevel::Text, SubLevel::Css, vec![]));
let resp_body = fetch_response.body.lock().unwrap();
let mut file = File::open(path).unwrap();
diff --git a/components/net/tests/hsts.rs b/components/net/tests/hsts.rs
index eca9d2a8d27..bd035a1616e 100644
--- a/components/net/tests/hsts.rs
+++ b/components/net/tests/hsts.rs
@@ -92,7 +92,7 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() {
list.push(HstsEntry::new("mozilla.org".to_owned(),
IncludeSubdomains::NotIncluded, Some(0)).unwrap());
- assert!(list.is_host_secure("mozilla.org") == false)
+ assert_eq!(list.is_host_secure("mozilla.org"), false)
}
#[test]
@@ -107,7 +107,7 @@ fn test_push_entry_to_hsts_list_should_not_add_subdomains_whose_superdomain_is_a
list.push(HstsEntry::new("servo.mozilla.org".to_owned(),
IncludeSubdomains::NotIncluded, None).unwrap());
- assert!(list.entries_map.get("mozilla.org").unwrap().len() == 1)
+ assert_eq!(list.entries_map.get("mozilla.org").unwrap().len(), 1)
}
#[test]
@@ -139,7 +139,7 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() {
list.push(HstsEntry::new("mozilla.org".to_owned(),
IncludeSubdomains::NotIncluded, None).unwrap());
- assert!(list.entries_map.get("mozilla.org").unwrap().len() == 1)
+ assert_eq!(list.entries_map.get("mozilla.org").unwrap().len(), 1)
}
#[test]