script_bindings: Eliminate DOMString::from_string (#43089)

This method is the same as `DOMString::from` with a `String` argument
and `From` and `Into` are preferred when writing modern Rust.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-03-08 12:46:42 +01:00
committed by GitHub
parent cea658e2c0
commit e725fdbfdf
36 changed files with 99 additions and 140 deletions

View File

@@ -145,10 +145,8 @@ impl HTMLProgressElementMethods<crate::DomTypeHolder> for HTMLProgressElement {
/// <https://html.spec.whatwg.org/multipage/#dom-progress-value>
fn SetValue(&self, new_val: Finite<f64>, can_gc: CanGc) {
if *new_val >= 0.0 {
let mut string_value = DOMString::from_string((*new_val).to_string());
let mut string_value = DOMString::from((*new_val).to_string());
string_value.set_best_representation_of_the_floating_point_number();
self.upcast::<Element>().set_string_attribute(
&local_name!("value"),
string_value,
@@ -177,10 +175,8 @@ impl HTMLProgressElementMethods<crate::DomTypeHolder> for HTMLProgressElement {
/// <https://html.spec.whatwg.org/multipage/#dom-progress-max>
fn SetMax(&self, new_val: Finite<f64>, can_gc: CanGc) {
if *new_val > 0.0 {
let mut string_value = DOMString::from_string((*new_val).to_string());
let mut string_value = DOMString::from((*new_val).to_string());
string_value.set_best_representation_of_the_floating_point_number();
self.upcast::<Element>().set_string_attribute(
&local_name!("max"),
string_value,