fix(clippy): Clippy suggestions in components/script/dom/* (#33072)

Signed-off-by: Jose T. Monagas <josetmonagas@proton.me>
Co-authored-by: Jose T. Monagas <josetmonagas@proton.me>
This commit is contained in:
Jose Monagas 2024-08-15 22:31:30 +03:00 committed by GitHub
parent 386a067c4b
commit a34920b605
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 15 deletions

View file

@ -147,7 +147,7 @@ impl InputType {
*self == InputType::Time
}
fn to_str(&self) -> &str {
fn as_str(&self) -> &str {
match *self {
InputType::Button => "button",
InputType::Checkbox => "checkbox",
@ -1203,7 +1203,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-type
fn Type(&self) -> DOMString {
DOMString::from(self.input_type().to_str())
DOMString::from(self.input_type().as_str())
}
// https://html.spec.whatwg.org/multipage/#dom-input-type
@ -1356,7 +1356,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-valueasnumber
fn ValueAsNumber(&self) -> f64 {
self.convert_string_to_number(&self.Value())
.unwrap_or(std::f64::NAN)
.unwrap_or(f64::NAN)
}
// https://html.spec.whatwg.org/multipage/#dom-input-valueasnumber