From ffe2cfe841bd567b606cc707be309634106d6b48 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:19:45 +0000 Subject: [PATCH 01/16] fix clippy problems in stylesheet --- components/script/stylesheet_loader.rs | 6 +++--- components/script/task_source/websocket.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 3b6c14525df8..03e7b84cfeea 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -134,14 +134,14 @@ impl FetchResponseListener for StylesheetContext { }); let data = if is_css { - mem::replace(&mut self.data, vec![]) + std::mem::take(&mut self.data) } else { vec![] }; // TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding let environment_encoding = UTF_8; - let protocol_encoding_label = metadata.charset.as_ref().map(|s| &**s); + let protocol_encoding_label = metadata.charset.as_deref(); let final_url = metadata.final_url; let win = window_from_node(&*elem); @@ -277,7 +277,7 @@ impl<'a> StylesheetLoader<'a> { .downcast::() .map(HTMLLinkElement::get_request_generation_id); let context = ::std::sync::Arc::new(Mutex::new(StylesheetContext { - elem: Trusted::new(&*self.elem), + elem: Trusted::new(self.elem), source: source, url: url.clone(), metadata: None, diff --git a/components/script/task_source/websocket.rs b/components/script/task_source/websocket.rs index ec5e263fe09b..27ad5202373b 100644 --- a/components/script/task_source/websocket.rs +++ b/components/script/task_source/websocket.rs @@ -16,7 +16,7 @@ pub struct WebsocketTaskSource( impl Clone for WebsocketTaskSource { fn clone(&self) -> WebsocketTaskSource { - WebsocketTaskSource(self.0.clone(), self.1.clone()) + WebsocketTaskSource(self.0.clone(), self.1) } } From 193cdb23f968c3c5a405c4f0447673a74d6510b5 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:21:05 +0000 Subject: [PATCH 02/16] fix clippy problems in task_manager --- components/script/task_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_manager.rs b/components/script/task_manager.rs index a732f8d5ddaa..d3671f682d2a 100644 --- a/components/script/task_manager.rs +++ b/components/script/task_manager.rs @@ -194,7 +194,7 @@ impl TaskManager { pub fn task_canceller(&self, name: TaskSourceName) -> TaskCanceller { let mut flags = self.task_cancellers.borrow_mut(); - let cancel_flag = flags.entry(name).or_insert(Default::default()); + let cancel_flag = flags.entry(name).or_default(); TaskCanceller { cancelled: cancel_flag.clone(), } From 907b01efc51883a6ad3fb973328797b95c92cc2e Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:22:41 +0000 Subject: [PATCH 03/16] fix clippy problems in task_queue --- components/script/task_queue.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index a3de0c4b52f0..5bde1f51591b 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -86,7 +86,7 @@ impl TaskQueue { /// fn store_task_for_inactive_pipeline(&self, msg: T, pipeline_id: &PipelineId) { let mut inactive = self.inactive.borrow_mut(); - let inactive_queue = inactive.entry(pipeline_id.clone()).or_default(); + let inactive_queue = inactive.entry(*pipeline_id).or_default(); inactive_queue.push_back( msg.into_queued_task() .expect("Incoming messages should always be convertible into queued tasks"), From 48d684b563b4843a8f0f6187655f2ca9c02c4ea7 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:26:56 +0000 Subject: [PATCH 04/16] fix clippy problems in task_queue --- components/script/task_queue.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 5bde1f51591b..6b5639e34e3e 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -152,7 +152,7 @@ impl TaskQueue { } } // Immediately send non-throttled tasks for processing. - let _ = self.msg_queue.borrow_mut().push_back(msg); + self.msg_queue.borrow_mut().push_back(msg); } for msg in to_be_throttled { @@ -237,16 +237,16 @@ impl TaskQueue { // Reduce the length of throttles, // but don't add the task to "msg_queue", // and neither increment "taken_task_counter". - throttled_length = throttled_length - 1; + throttled_length - 1; continue; } } // Make the task available for the event-loop to handle as a message. - let _ = self.msg_queue.borrow_mut().push_back(msg); + self.msg_queue.borrow_mut().push_back(msg); self.taken_task_counter .set(self.taken_task_counter.get() + 1); - throttled_length = throttled_length - 1; + throttled_length - 1; }, } } From 1406b01290079815c7eafab292e750a6656cb3f8 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:29:57 +0000 Subject: [PATCH 05/16] fix clippy problems in file_reading --- components/script/task_source/file_reading.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index ebf37249b591..77e566dbf63a 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -18,7 +18,7 @@ pub struct FileReadingTaskSource( impl Clone for FileReadingTaskSource { fn clone(&self) -> FileReadingTaskSource { - FileReadingTaskSource(self.0.clone(), self.1.clone()) + FileReadingTaskSource(self.0.clone(), self.1) } } From 78372f2a179e054847d188e17b3eaad4b1f512e7 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:31:14 +0000 Subject: [PATCH 06/16] fix clippy problems in dom_manipulation --- components/script/task_source/dom_manipulation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index 64c2b3a33c6f..9672986b3842 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -22,7 +22,7 @@ pub struct DOMManipulationTaskSource(pub Box, #[no_trace] impl Clone for DOMManipulationTaskSource { fn clone(&self) -> DOMManipulationTaskSource { - DOMManipulationTaskSource(self.0.clone(), self.1.clone()) + DOMManipulationTaskSource(self.0.clone(), self.1) } } From be5783af7b4a46953e0a4dc9a5864068e75db167 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:32:17 +0000 Subject: [PATCH 07/16] fix clippy problems in gamepad --- components/script/task_source/gamepad.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/gamepad.rs b/components/script/task_source/gamepad.rs index 5adf519a5e83..e6694f3daea1 100644 --- a/components/script/task_source/gamepad.rs +++ b/components/script/task_source/gamepad.rs @@ -19,7 +19,7 @@ pub struct GamepadTaskSource( impl Clone for GamepadTaskSource { fn clone(&self) -> GamepadTaskSource { - GamepadTaskSource(self.0.clone(), self.1.clone()) + GamepadTaskSource(self.0.clone(), self.1) } } From a9bb8e873aedc2bcebcba060f78078403c1a307a Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:32:58 +0000 Subject: [PATCH 08/16] fix clippy problems in networking --- components/script/task_source/networking.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index b95e20aa9feb..b55331af5263 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.rs @@ -16,7 +16,7 @@ pub struct NetworkingTaskSource( impl Clone for NetworkingTaskSource { fn clone(&self) -> NetworkingTaskSource { - NetworkingTaskSource(self.0.clone(), self.1.clone()) + NetworkingTaskSource(self.0.clone(), self.1) } } From f4c7d05fb5a8fe97ba5cc716adce437fcb882b8f Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:33:52 +0000 Subject: [PATCH 09/16] fix clippy problems in performance --- components/script/task_source/performance_timeline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index b66f1c496b8a..9f6f56a2cf42 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -25,7 +25,7 @@ pub struct PerformanceTimelineTaskSource( impl Clone for PerformanceTimelineTaskSource { fn clone(&self) -> PerformanceTimelineTaskSource { - PerformanceTimelineTaskSource(self.0.clone(), self.1.clone()) + PerformanceTimelineTaskSource(self.0.clone(), self.1) } } From 70b105f5cc950d08f7e4545d0ce161e368eab9d9 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:34:55 +0000 Subject: [PATCH 10/16] fix clippy problems in port_message --- components/script/task_source/port_message.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/port_message.rs b/components/script/task_source/port_message.rs index 30fe007cbf44..b9bca1e61946 100644 --- a/components/script/task_source/port_message.rs +++ b/components/script/task_source/port_message.rs @@ -18,7 +18,7 @@ pub struct PortMessageQueue( impl Clone for PortMessageQueue { fn clone(&self) -> PortMessageQueue { - PortMessageQueue(self.0.clone(), self.1.clone()) + PortMessageQueue(self.0.clone(), self.1) } } From bc09086ee91ddc1a3dc0fd67b6c482c818a114ac Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:35:36 +0000 Subject: [PATCH 11/16] fix clippy problems in port_message --- components/script/task_source/remote_event.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/remote_event.rs b/components/script/task_source/remote_event.rs index 061558af6c9b..cadba9b3016e 100644 --- a/components/script/task_source/remote_event.rs +++ b/components/script/task_source/remote_event.rs @@ -16,7 +16,7 @@ pub struct RemoteEventTaskSource( impl Clone for RemoteEventTaskSource { fn clone(&self) -> RemoteEventTaskSource { - RemoteEventTaskSource(self.0.clone(), self.1.clone()) + RemoteEventTaskSource(self.0.clone(), self.1) } } From afb0604fe5239a2c55a541ffb9ae84f11b785314 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:36:55 +0000 Subject: [PATCH 12/16] fix clippy problems in timer --- components/script/task_source/timer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_source/timer.rs b/components/script/task_source/timer.rs index 856e05921f45..e565a3aaa22b 100644 --- a/components/script/task_source/timer.rs +++ b/components/script/task_source/timer.rs @@ -19,7 +19,7 @@ pub struct TimerTaskSource( impl Clone for TimerTaskSource { fn clone(&self) -> TimerTaskSource { - TimerTaskSource(self.0.clone(), self.1.clone()) + TimerTaskSource(self.0.clone(), self.1) } } From d068d476aa20e02add467772501523825647b0b8 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 11:38:39 +0000 Subject: [PATCH 13/16] fix clippy problems in stylesheet --- components/script/stylesheet_loader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 03e7b84cfeea..55fb480ac2ee 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::mem; + use std::sync::atomic::AtomicBool; use std::sync::Mutex; From aecf6e545fa21e4d1f322ac7893e6284a873346e Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 12:02:42 +0000 Subject: [PATCH 14/16] fix clippy problems --- components/script/stylesheet_loader.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 55fb480ac2ee..8ba0760840f3 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - use std::sync::atomic::AtomicBool; use std::sync::Mutex; From 600da6b9a1a46ac5a8839c05b0b143e9bd6b5d66 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 13:20:48 +0000 Subject: [PATCH 15/16] fix clippy problems --- components/script/task_queue.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 6b5639e34e3e..4b489b7eec49 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -237,7 +237,7 @@ impl TaskQueue { // Reduce the length of throttles, // but don't add the task to "msg_queue", // and neither increment "taken_task_counter". - throttled_length - 1; + throttled_length - =1; continue; } } @@ -246,7 +246,7 @@ impl TaskQueue { self.msg_queue.borrow_mut().push_back(msg); self.taken_task_counter .set(self.taken_task_counter.get() + 1); - throttled_length - 1; + throttled_length -= 1; }, } } From 7bcaf640e5bd1a29dd3f79e5833ec492d194dd74 Mon Sep 17 00:00:00 2001 From: six-shot Date: Wed, 20 Mar 2024 13:27:59 +0000 Subject: [PATCH 16/16] fix clippy problems --- components/script/task_queue.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 4b489b7eec49..1fac477865ed 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -237,7 +237,7 @@ impl TaskQueue { // Reduce the length of throttles, // but don't add the task to "msg_queue", // and neither increment "taken_task_counter". - throttled_length - =1; + throttled_length -= 1; continue; } }