diff options
author | Tugdual JULLIEN <tugdual.jullien@gmail.com> | 2019-10-05 11:16:00 +0200 |
---|---|---|
committer | Tugdual JULLIEN <tugdual.jullien@gmail.com> | 2019-10-05 11:18:51 +0200 |
commit | 85e641827190b02d612c4f6f09f74245bdbc65da (patch) | |
tree | 065228049f5d675834b6e453be071717d068b70c /components/net/http_cache.rs | |
parent | 9785613310f754ecd90665e99f30a74936a9e765 (diff) | |
download | servo-85e641827190b02d612c4f6f09f74245bdbc65da.tar.gz servo-85e641827190b02d612c4f6f09f74245bdbc65da.zip |
Pass argument by reference to CacheKey constructor
Argument now passed by reference, and clone() removed when calling
constructor.
Diffstat (limited to 'components/net/http_cache.rs')
-rw-r--r-- | components/net/http_cache.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs index d31adc4f36d..9654c64acfa 100644 --- a/components/net/http_cache.rs +++ b/components/net/http_cache.rs @@ -38,7 +38,7 @@ pub struct CacheKey { } impl CacheKey { - fn new(request: Request) -> CacheKey { + fn new(request: &Request) -> CacheKey { CacheKey { url: request.current_url(), } @@ -575,7 +575,7 @@ impl HttpCache { // Only Get requests are cached, avoid a url based match for others. return None; } - let entry_key = CacheKey::new(request.clone()); + let entry_key = CacheKey::new(&request); let resources = self .entries .get(&entry_key)? @@ -672,7 +672,7 @@ impl HttpCache { if let ResponseBody::Done(ref completed_body) = *response.actual_response().body.lock().unwrap() { - let entry_key = CacheKey::new(request.clone()); + let entry_key = CacheKey::new(&request); if let Some(cached_resources) = self.entries.get(&entry_key) { // Ensure we only wake-up consumers of relevant resources, // ie we don't want to wake-up 200 awaiting consumers with a 206. @@ -709,7 +709,7 @@ impl HttpCache { done_chan: &mut DoneChannel, ) -> Option<Response> { assert_eq!(response.status.map(|s| s.0), Some(StatusCode::NOT_MODIFIED)); - let entry_key = CacheKey::new(request.clone()); + let entry_key = CacheKey::new(&request); if let Some(cached_resources) = self.entries.get_mut(&entry_key) { for cached_resource in cached_resources.iter_mut() { // done_chan will have been set to Some(..) by http_network_fetch. @@ -809,7 +809,7 @@ impl HttpCache { // responses to be stored is present in the response. return; }; - let entry_key = CacheKey::new(request.clone()); + let entry_key = CacheKey::new(&request); let metadata = match response.metadata() { Ok(FetchMetadata::Filtered { filtered: _, |