From c3360df9189271eee039f0a74d73e0c2b48a4796 Mon Sep 17 00:00:00 2001 From: komuhangi <51232461+jahielkomu@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:51:16 +0300 Subject: [PATCH] Fixed some clippy warnings in components/script (#31950) * Fixd some clippy warnings in components/script * Update node.rs Removed the ```# Safety ``` section. * Update shadow_root.rs Removed the ``` # Safety ``` section from components/script/layout_dom * Updated fixes to some clippy warnings in components/script * Revert "Updated fixes to some clippy warnings in components/script" This reverts commit 2a37c3dec8e68df132e788663567a0db94e0edb4. * Updated fixes to clippy warnings in components/script * Revert "Updated fixes to clippy warnings in components/script" This reverts commit 5780dc3a0a8d51d4b36f56c095d0cc6c63c0cb36. * Revert "Revert "Updated fixes to some clippy warnings in components/script"" This reverts commit 98c411354a0ed00ad8e43e8d1be06d1a7007d244. * Revert "Updated fixes to some clippy warnings in components/script" This reverts commit 2a37c3dec8e68df132e788663567a0db94e0edb4. * Update shadow_root.rs (Ignore change) * Update node.rs (Ignore changes) * Updated fixes to clippy warnings in components/script * Removed trailing white space in componets/script/layout_dom_root.rs * Revert "Removed trailing white space in componets/script/layout_dom_root.rs" This reverts commit 1976fd040565c7624338fa904e527c5f9f0fd1ab. * Revert "Updated fixes to clippy warnings in components/script" This reverts commit 5c71b925fb8dd833243eb4e1ca99b80359596f51. * Updated fixes to clippy warnings in components/script including review suggestions. --- components/script/dom/window.rs | 7 +++---- components/script/layout_dom/node.rs | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 14b45c5615d..0dd190ef2f1 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -2314,7 +2314,7 @@ impl Window { self.Document().url() } - pub fn with_layout<'a, T>(&self, call: impl FnOnce(&mut dyn Layout) -> T) -> Result { + pub fn with_layout(&self, call: impl FnOnce(&mut dyn Layout) -> T) -> Result { ScriptThread::with_layout(self.pipeline_id(), call) } @@ -2414,9 +2414,7 @@ impl Window { reply: IpcSender>, ) { *self.devtools_marker_sender.borrow_mut() = Some(reply); - self.devtools_markers - .borrow_mut() - .extend(markers.into_iter()); + self.devtools_markers.borrow_mut().extend(markers); } pub fn drop_devtools_timeline_markers(&self, markers: Vec) { @@ -2522,6 +2520,7 @@ impl Window { impl Window { #[allow(unsafe_code)] + #[allow(clippy::too_many_arguments)] pub fn new( runtime: Rc, script_chan: MainThreadScriptChan, diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs index a941009dcda..c331f4aa5e3 100644 --- a/components/script/layout_dom/node.rs +++ b/components/script/layout_dom/node.rs @@ -54,12 +54,12 @@ pub struct ServoLayoutNode<'dom, LayoutDataType: LayoutDataTrait> { pub(super) phantom: PhantomData, } -//// Those are supposed to be sound, but they aren't because the entire system -//// between script and layout so far has been designed to work around their -//// absence. Switching the entire thing to the inert crate infra will help. +/// Those are supposed to be sound, but they aren't because the entire system +/// between script and layout so far has been designed to work around their +/// absence. Switching the entire thing to the inert crate infra will help. /// -//// FIXME(mrobinson): These are required because Layout 2020 sends non-threadsafe -//// nodes to different threads. This should be adressed in a comprehensive way. +/// FIXME(mrobinson): These are required because Layout 2020 sends non-threadsafe +/// nodes to different threads. This should be adressed in a comprehensive way. unsafe impl Send for ServoLayoutNode<'_, LayoutDataType> {} unsafe impl Sync for ServoLayoutNode<'_, LayoutDataType> {}