aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-22 19:30:51 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-22 19:30:51 -0600
commitdfb8929b001c8d0fb6d5e63f5a9d6dcc17cb388a (patch)
tree52127967aac7d9deec1b79b61b9b96d5604c9b77
parent445f1c891a5536a26b4759ba4b2dab99c31505f4 (diff)
parent5a780cb2214744ee5f1e60c5b051ebcbcf51c9e9 (diff)
downloadservo-dfb8929b001c8d0fb6d5e63f5a9d6dcc17cb388a.tar.gz
servo-dfb8929b001c8d0fb6d5e63f5a9d6dcc17cb388a.zip
auto merge of #5316 : frewsxcv/servo/no-format-abuse, r=jdm
In these cases for `format!`, we're just constructing a String of the single argument with no special format.
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/xmlhttprequest.rs4
-rw-r--r--components/script/script_task.rs2
-rw-r--r--components/util/opts.rs2
-rw-r--r--tests/contenttest.rs4
5 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 243951600e5..d6e5f49b433 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -1090,7 +1090,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
fn LastModified(self) -> DOMString {
match self.last_modified {
Some(ref t) => t.clone(),
- None => format!("{}", time::now().strftime("%m/%d/%Y %H:%M:%S").unwrap()),
+ None => time::now().strftime("%m/%d/%Y %H:%M:%S").unwrap().to_string(),
}
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 6b259ec732b..ec65f98b7b9 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -616,13 +616,13 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
referer_url.serialize_host().map(|ref h| buf.push_str(h.as_slice()));
referer_url.port().as_ref().map(|&p| {
buf.push_str(":".as_slice());
- buf.push_str(format!("{}", p).as_slice());
+ buf.push_str(p.to_string().as_slice());
});
referer_url.serialize_path().map(|ref h| buf.push_str(h.as_slice()));
self.request_headers.borrow_mut().set_raw("Referer".to_owned(), vec![buf.into_bytes()]);
},
Ok(Some(ref req)) => self.insert_trusted_header("origin".to_owned(),
- format!("{}", req.origin)),
+ req.origin.to_string()),
_ => {}
}
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 6f15836eb5d..19c8c96ead0 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -1298,5 +1298,5 @@ pub fn get_page(page: &Rc<Page>, pipeline_id: PipelineId) -> Rc<Page> {
}
fn dom_last_modified(tm: &Tm) -> String {
- format!("{}", tm.to_local().strftime("%m/%d/%Y %H:%M:%S").unwrap())
+ tm.to_local().strftime("%m/%d/%Y %H:%M:%S").unwrap().to_string()
}
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 9cc16b97302..24b945dfcf7 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -237,7 +237,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
let opt_match = match getopts::getopts(args, opts.as_slice()) {
Ok(m) => m,
Err(f) => {
- args_fail(format!("{}", f).as_slice());
+ args_fail(f.to_string().as_slice());
return false;
}
};
diff --git a/tests/contenttest.rs b/tests/contenttest.rs
index 7e8bb71fd66..77210a8dbd8 100644
--- a/tests/contenttest.rs
+++ b/tests/contenttest.rs
@@ -45,7 +45,7 @@ fn parse_config(args: Vec<String>) -> Config {
let opts = vec!(reqopt("s", "source-dir", "source-dir", "source-dir"));
let matches = match getopts(args, opts.as_slice()) {
Ok(m) => m,
- Err(f) => panic!(format!("{}", f))
+ Err(f) => panic!(f.to_string())
};
Config {
@@ -73,7 +73,7 @@ fn find_tests(config: Config) -> Vec<TestDescAndFn> {
_ => panic!("Error reading directory."),
};
files.retain(|file| file.extension_str() == Some("html") );
- return files.iter().map(|file| make_test(format!("{}", file.display()))).collect();
+ return files.iter().map(|file| make_test(file.display().to_string())).collect();
}
fn make_test(file: String) -> TestDescAndFn {