From a068a806190490dcf5830563dd0d15f3416b31f5 Mon Sep 17 00:00:00 2001 From: Sam Gibson Date: Wed, 8 Jul 2015 18:26:10 +1200 Subject: [PATCH] Don't unnecessarily clone strings --- components/net/resource_task.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index f46e35057dc..9ee9bb4699c 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -267,21 +267,21 @@ impl HSTSList { }) } - fn has_domain(&self, host: String) -> bool { + fn has_domain(&self, host: &str) -> bool { self.entries.iter().any(|e| { e.matches_domain(&host) }) } - fn has_subdomain(&self, host: String) -> bool { + fn has_subdomain(&self, host: &str) -> bool { self.entries.iter().any(|e| { - e.matches_subdomain(&host) + e.matches_subdomain(host) }) } pub fn push(&mut self, entry: HSTSEntry) { - let have_domain = self.has_domain(entry.host.clone()); - let have_subdomain = self.has_subdomain(entry.host.clone()); + let have_domain = self.has_domain(&entry.host); + let have_subdomain = self.has_subdomain(&entry.host); if !have_domain && !have_subdomain { self.entries.push(entry);