diff options
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 3a51a5859a7..0d0592fa51e 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -933,7 +933,7 @@ impl Document { pub fn register_form_id_listener<T: ?Sized + FormControl>(&self, id: DOMString, listener: &T) { let mut map = self.form_id_listener_map.borrow_mut(); let listener = listener.to_element(); - let set = map.entry(Atom::from(id)).or_insert(HashSet::new()); + let set = map.entry(Atom::from(id)).or_default(); set.insert(Dom::from_ref(listener)); } @@ -1075,7 +1075,7 @@ impl Document { /// <https://html.spec.whatwg.org/multipage/#focus-fixup-rule> pub(crate) fn perform_focus_fixup_rule(&self, not_focusable: &Element) { - if Some(not_focusable) != self.focused.get().as_ref().map(|e| &**e) { + if Some(not_focusable) != self.focused.get().as_deref() { return; } self.request_focus( @@ -1114,7 +1114,7 @@ impl Document { }, }; *self.focus_transaction.borrow_mut() = FocusTransaction::NotInTransaction; - if self.focused == possibly_focused.as_ref().map(|e| &**e) { + if self.focused == possibly_focused.as_deref() { return; } if let Some(ref elem) = self.focused.get() { @@ -1129,7 +1129,7 @@ impl Document { } } - self.focused.set(possibly_focused.as_ref().map(|e| &**e)); + self.focused.set(possibly_focused.as_deref()); if let Some(ref elem) = self.focused.get() { elem.set_focus_state(true); @@ -1152,7 +1152,7 @@ impl Document { let (text, multiline) = if let Some(input) = elem.downcast::<HTMLInputElement>() { ( Some(( - (&input.Value()).to_string(), + input.Value().to_string(), input.GetSelectionEnd().unwrap_or(0) as i32, )), false, @@ -1160,7 +1160,7 @@ impl Document { } else if let Some(textarea) = elem.downcast::<HTMLTextAreaElement>() { ( Some(( - (&textarea.Value()).to_string(), + textarea.Value().to_string(), textarea.GetSelectionEnd().unwrap_or(0) as i32, )), true, @@ -1188,7 +1188,7 @@ impl Document { title.clone(), )); let global = self.window.upcast::<GlobalScope>(); - if let Some(ref chan) = global.devtools_chan() { + if let Some(chan) = global.devtools_chan() { let _ = chan.send(ScriptToDevtoolsControlMsg::TitleChanged( global.pipeline_id(), title, @@ -3031,7 +3031,7 @@ fn get_registrable_domain_suffix_of_or_is_equal_to( let index = original_host.len().checked_sub(host.len())?; let (prefix, suffix) = original_host.split_at(index); - if !prefix.ends_with(".") { + if !prefix.ends_with('.') { return None; } if suffix != host { |