aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/formdata.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/formdata.rs')
-rw-r--r--components/script/dom/formdata.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index 8390430c39e..8631cefbd4a 100644
--- a/components/script/dom/formdata.rs
+++ b/components/script/dom/formdata.rs
@@ -85,21 +85,14 @@ impl FormDataMethods for FormData {
self.data.borrow_mut().remove(&name);
}
- #[allow(unsafe_code)]
// https://xhr.spec.whatwg.org/#dom-formdata-get
fn Get(&self, name: DOMString) -> Option<FileOrString> {
- // FIXME(https://github.com/rust-lang/rust/issues/23338)
- let data = self.data.borrow();
- if data.contains_key(&name) {
- match data[&name][0].clone() {
- FormDatum::StringData(ref s) => Some(eString(s.clone())),
- FormDatum::FileData(ref f) => {
- Some(eFile(f.root()))
- }
- }
- } else {
- None
- }
+ self.data.borrow()
+ .get(&name)
+ .map(|entry| match entry[0] {
+ FormDatum::StringData(ref s) => eString(s.clone()),
+ FormDatum::FileData(ref f) => eFile(f.root()),
+ })
}
// https://xhr.spec.whatwg.org/#dom-formdata-has