clippy: Fix warnings in components/shared (#31627)

* clippy: fix warnings in `components/shared`

* fix: formatting derive

* fix: rename new to default
This commit is contained in:
eri 2024-03-12 18:22:05 +01:00 committed by GitHub
parent 4efebf1e62
commit 21939c2ba8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 36 additions and 50 deletions

View file

@ -131,7 +131,7 @@ impl ScrollTreeNode {
let scrollable_width = info.scrollable_size.width;
let scrollable_height = info.scrollable_size.height;
let original_layer_scroll_offset = info.offset.clone();
let original_layer_scroll_offset = info.offset;
if scrollable_width > 0. {
info.offset.x = (info.offset.x + delta.x).min(0.0).max(-scrollable_width);
@ -172,10 +172,10 @@ impl ScrollTree {
parent: parent.cloned(),
scroll_info,
});
return ScrollTreeNodeId {
ScrollTreeNodeId {
index: self.nodes.len() - 1,
spatial_id,
};
}
}
/// Get a mutable reference to the node with the given index.
@ -198,7 +198,7 @@ impl ScrollTree {
scroll_location: ScrollLocation,
) -> Option<(ExternalScrollId, LayoutVector2D)> {
let parent = {
let ref mut node = self.get_node_mut(scroll_node_id);
let node = &mut self.get_node_mut(scroll_node_id);
let result = node.scroll(scroll_location);
if result.is_some() {
return result;