mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
clippy: Fix a few problems in components/script/dom
(#31955)
* fixed various clippy warnings * fixed various clippy warnings * fixed various clippy warnings
This commit is contained in:
parent
9401102691
commit
00c4d798c9
5 changed files with 7 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Node> {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue