aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/net/mime_classifier.rs4
-rw-r--r--components/profile/mem.rs2
-rw-r--r--components/webdriver_server/lib.rs8
-rw-r--r--python/tidy.py4
4 files changed, 11 insertions, 7 deletions
diff --git a/components/net/mime_classifier.rs b/components/net/mime_classifier.rs
index 948425890e3..29f559a4738 100644
--- a/components/net/mime_classifier.rs
+++ b/components/net/mime_classifier.rs
@@ -129,8 +129,8 @@ impl MIMEClassifier {
}
}
- fn get_media_type(media_type: &String,
- media_subtype: &String) -> Option<MediaType> {
+ fn get_media_type(media_type: &str,
+ media_subtype: &str) -> Option<MediaType> {
if MIMEClassifier::is_xml(media_type, media_subtype) {
Some(MediaType::Xml)
} else if MIMEClassifier::is_html(media_type, media_subtype) {
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 0bd91f7afed..becd2d05554 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -225,7 +225,7 @@ impl ReportsTree {
// Searches the tree's children for a path_seg match, and returns the index if there is a
// match.
- fn find_child(&self, path_seg: &String) -> Option<usize> {
+ fn find_child(&self, path_seg: &str) -> Option<usize> {
for (i, child) in self.children.iter().enumerate() {
if child.path_seg == *path_seg {
return Some(i);
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 9bad724d164..22acb46d52d 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -525,11 +525,11 @@ impl Handler {
}
}
- fn handle_element_attribute(&self, element: &WebElement, name: &String) -> WebDriverResult<WebDriverResponse> {
+ fn handle_element_attribute(&self, element: &WebElement, name: &str) -> WebDriverResult<WebDriverResponse> {
let pipeline_id = try!(self.frame_pipeline());
let (sender, receiver) = ipc::channel().unwrap();
- let cmd = WebDriverScriptCommand::GetElementAttribute(element.id.clone(), name.clone(), sender);
+ let cmd = WebDriverScriptCommand::GetElementAttribute(element.id.clone(), name.to_owned(), sender);
let cmd_msg = WebDriverCommandMsg::ScriptCommand(pipeline_id, cmd);
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
match receiver.recv().unwrap() {
@@ -539,11 +539,11 @@ impl Handler {
}
}
- fn handle_element_css(&self, element: &WebElement, name: &String) -> WebDriverResult<WebDriverResponse> {
+ fn handle_element_css(&self, element: &WebElement, name: &str) -> WebDriverResult<WebDriverResponse> {
let pipeline_id = try!(self.frame_pipeline());
let (sender, receiver) = ipc::channel().unwrap();
- let cmd = WebDriverScriptCommand::GetElementCSS(element.id.clone(), name.clone(), sender);
+ let cmd = WebDriverScriptCommand::GetElementCSS(element.id.clone(), name.to_owned(), sender);
let cmd_msg = WebDriverCommandMsg::ScriptCommand(pipeline_id, cmd);
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
match receiver.recv().unwrap() {
diff --git a/python/tidy.py b/python/tidy.py
index dd2ef9d29cc..499fb8c5efc 100644
--- a/python/tidy.py
+++ b/python/tidy.py
@@ -369,6 +369,10 @@ def check_rust(file_name, contents):
if ": &Vec<" in line:
yield (idx + 1, "use &[T] instead of &Vec<T>")
+ # No benefit over using &str
+ if ": &String" in line:
+ yield (idx + 1, "use &str instead of &String")
+
# Avoid flagging <Item=Foo> constructs
def is_associated_type(match, line, index):