Fixd some clippy warnings in components/script

This commit is contained in:
jahielkomu 2024-03-30 23:57:01 +03:00
parent 92d9081366
commit e74a03724f
3 changed files with 13 additions and 10 deletions

View file

@ -2314,7 +2314,7 @@ impl Window {
self.Document().url() self.Document().url()
} }
pub fn with_layout<'a, T>(&self, call: impl FnOnce(&mut dyn Layout) -> T) -> Result<T, ()> { pub fn with_layout<T>(&self, call: impl FnOnce(&mut dyn Layout) -> T) -> Result<T, ()> {
ScriptThread::with_layout(self.pipeline_id(), call) ScriptThread::with_layout(self.pipeline_id(), call)
} }
@ -2414,9 +2414,7 @@ impl Window {
reply: IpcSender<Option<TimelineMarker>>, reply: IpcSender<Option<TimelineMarker>>,
) { ) {
*self.devtools_marker_sender.borrow_mut() = Some(reply); *self.devtools_marker_sender.borrow_mut() = Some(reply);
self.devtools_markers self.devtools_markers.borrow_mut().extend(markers);
.borrow_mut()
.extend(markers.into_iter());
} }
pub fn drop_devtools_timeline_markers(&self, markers: Vec<TimelineMarkerType>) { pub fn drop_devtools_timeline_markers(&self, markers: Vec<TimelineMarkerType>) {

View file

@ -54,12 +54,12 @@ pub struct ServoLayoutNode<'dom, LayoutDataType: LayoutDataTrait> {
pub(super) phantom: PhantomData<LayoutDataType>, pub(super) phantom: PhantomData<LayoutDataType>,
} }
//// Those are supposed to be sound, but they aren't because the entire system /// 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 /// 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. /// absence. Switching the entire thing to the inert crate infra will help.
/// ///
//// FIXME(mrobinson): These are required because Layout 2020 sends non-threadsafe /// FIXME(mrobinson): These are required because Layout 2020 sends non-threadsafe
//// nodes to different threads. This should be adressed in a comprehensive way. /// nodes to different threads. This should be adressed in a comprehensive way.
unsafe impl<LayoutDataType: LayoutDataTrait> Send for ServoLayoutNode<'_, LayoutDataType> {} unsafe impl<LayoutDataType: LayoutDataTrait> Send for ServoLayoutNode<'_, LayoutDataType> {}
unsafe impl<LayoutDataType: LayoutDataTrait> Sync for ServoLayoutNode<'_, LayoutDataType> {} unsafe impl<LayoutDataType: LayoutDataTrait> Sync for ServoLayoutNode<'_, LayoutDataType> {}
@ -97,7 +97,9 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoLayoutNode<'dom, LayoutDataType
phantom: PhantomData, phantom: PhantomData,
} }
} }
/// # Safety
///
/// This function should not be called if there is no TrustedNodeAddress.
pub unsafe fn new(address: &TrustedNodeAddress) -> Self { pub unsafe fn new(address: &TrustedNodeAddress) -> Self {
ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address)) ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address))
} }

View file

@ -71,6 +71,9 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoShadowRoot<'dom, LayoutDataType
} }
} }
/// # Safety
///
/// This function should not mutate StyleSharedRwLockReadGuard.
pub unsafe fn flush_stylesheets( pub unsafe fn flush_stylesheets(
&self, &self,
stylist: &mut Stylist, stylist: &mut Stylist,