clippy: Fix several warnings in components/script and components/webgpu (#33633)

* clippy: Fix several warnings in components

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* fix: Allow upper_case_acronyms

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* clippy: Fix more warnings

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

---------

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
tanishka 2024-10-04 10:59:10 +05:30 committed by GitHub
parent 6e043cd09e
commit 03b8034f68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 3 deletions

View file

@ -12,6 +12,7 @@ use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::str::DOMString; use crate::dom::bindings::str::DOMString;
use crate::dom::window::Window; use crate::dom::window::Window;
#[allow(clippy::upper_case_acronyms)]
pub type UUID = DOMString; pub type UUID = DOMString;
pub type BluetoothServiceUUID = StringOrUnsignedLong; pub type BluetoothServiceUUID = StringOrUnsignedLong;
pub type BluetoothCharacteristicUUID = StringOrUnsignedLong; pub type BluetoothCharacteristicUUID = StringOrUnsignedLong;

View file

@ -19,6 +19,7 @@ use crate::dom::window::Window;
use crate::dom::worklet::Worklet; use crate::dom::worklet::Worklet;
#[dom_struct] #[dom_struct]
#[allow(clippy::upper_case_acronyms)]
pub struct CSS { pub struct CSS {
reflector_: Reflector, reflector_: Reflector,
} }

View file

@ -28,6 +28,7 @@ use crate::realms::InRealm;
use crate::task_source::{TaskSource, TaskSourceName}; use crate::task_source::{TaskSource, TaskSourceName};
#[dom_struct] #[dom_struct]
#[allow(clippy::upper_case_acronyms)]
pub struct GPU { pub struct GPU {
reflector_: Reflector, reflector_: Reflector,
} }

View file

@ -398,7 +398,7 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
} else { } else {
// Step 3&4 // Step 3&4
self.replace_drawing_buffer(); self.replace_drawing_buffer();
let current_texture = configuration.device.CreateTexture(&texture_descriptor)?; let current_texture = configuration.device.CreateTexture(texture_descriptor)?;
self.current_texture.set(Some(&current_texture)); self.current_texture.set(Some(&current_texture));
current_texture current_texture
}; };

View file

@ -27,6 +27,7 @@ use crate::script_runtime::CanGc;
/// <https://url.spec.whatwg.org/#url> /// <https://url.spec.whatwg.org/#url>
#[dom_struct] #[dom_struct]
#[allow(clippy::upper_case_acronyms)]
pub struct URL { pub struct URL {
reflector_: Reflector, reflector_: Reflector,

View file

@ -1678,6 +1678,7 @@ fn serialize_document(doc: &Document) -> Fallible<DOMString> {
pub fn is_field_value(slice: &[u8]) -> bool { pub fn is_field_value(slice: &[u8]) -> bool {
// Classifications of characters necessary for the [CRLF] (SP|HT) rule // Classifications of characters necessary for the [CRLF] (SP|HT) rule
#[derive(PartialEq)] #[derive(PartialEq)]
#[allow(clippy::upper_case_acronyms)]
enum PreviousCharacter { enum PreviousCharacter {
Other, Other,
CR, CR,

View file

@ -141,9 +141,9 @@ pub struct WebGPUImageDescriptor(pub ImageDescriptor);
impl WebGPUImageDescriptor { impl WebGPUImageDescriptor {
fn new(format: ImageFormat, size: DeviceIntSize, is_opaque: bool) -> Self { fn new(format: ImageFormat, size: DeviceIntSize, is_opaque: bool) -> Self {
let stride = (((size.width * format.bytes_per_pixel()) | let stride = ((size.width * format.bytes_per_pixel()) |
(wgt::COPY_BYTES_PER_ROW_ALIGNMENT as i32 - 1)) + (wgt::COPY_BYTES_PER_ROW_ALIGNMENT as i32 - 1)) +
1) as i32; 1;
Self(ImageDescriptor { Self(ImageDescriptor {
format, format,
size, size,