diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 2fe0ab948b2..713498c9d3a 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -90,7 +90,7 @@ pub struct FileReaderSharedFunctionality; impl FileReaderSharedFunctionality { pub fn dataurl_format(blob_contents: &[u8], blob_type: String) -> DOMString { - let base64 = base64::engine::general_purpose::STANDARD.encode(&blob_contents); + let base64 = base64::engine::general_purpose::STANDARD.encode(blob_contents); let dataurl = if blob_type.is_empty() { format!("data:base64,{}", base64) diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 2e157a896d9..3bc1d35b9b7 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -1186,9 +1186,7 @@ impl HTMLScriptElement { (Some(ref ty), _) => { debug!("script type={}", &***ty); - if ty.to_ascii_lowercase().trim_matches(HTML_SPACE_CHARACTERS) == - String::from("module") - { + if ty.to_ascii_lowercase().trim_matches(HTML_SPACE_CHARACTERS) == "module" { return Some(ScriptType::Module); } diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 72bd5350f6d..0cf64e264d0 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -296,11 +296,11 @@ impl Range { } fn start(&self) -> &BoundaryPoint { - &self.abstract_range().start() + self.abstract_range().start() } fn end(&self) -> &BoundaryPoint { - &self.abstract_range().end() + self.abstract_range().end() } pub fn start_container(&self) -> DomRoot { diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index dea35a17e40..13ae19333b5 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -874,7 +874,7 @@ impl TestBindingMethods for TestBinding { .get(pref_name.as_ref()) .as_str() .map(DOMString::from) - .unwrap_or_else(DOMString::new) + .unwrap_or_default() } fn PrefControlledAttributeDisabled(&self) -> bool { false diff --git a/components/script/dom/vertexarrayobject.rs b/components/script/dom/vertexarrayobject.rs index 08ce5fb9854..b283a0b8f26 100644 --- a/components/script/dom/vertexarrayobject.rs +++ b/components/script/dom/vertexarrayobject.rs @@ -106,13 +106,13 @@ impl VertexArrayObject { .get_mut(index as usize) .ok_or(WebGLError::InvalidValue)?; - if size < 1 || size > 4 { + if !(1..=4).contains(&size) { return Err(WebGLError::InvalidValue); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#BUFFER_OFFSET_AND_STRIDE // https://www.khronos.org/registry/webgl/specs/latest/1.0/#VERTEX_STRIDE - if stride < 0 || stride > 255 || offset < 0 { + if !(0..=255).contains(&stride) || offset < 0 { return Err(WebGLError::InvalidValue); }