gpui: Pass Style by value to request_layout (#11597)
A minor thing I've spotted and decided to fix on the spot. It was being cloned twice within the body of that function (one of which was redundant even without this PR); now in most cases we go down from 2 clones to 0. Release Notes: - N/A
This commit is contained in:
@@ -93,7 +93,7 @@ impl Element for Anchored {
|
||||
..Style::default()
|
||||
};
|
||||
|
||||
let layout_id = cx.request_layout(&anchored_style, child_layout_ids.iter().copied());
|
||||
let layout_id = cx.request_layout(anchored_style, child_layout_ids.iter().copied());
|
||||
|
||||
(layout_id, AnchoredState { child_layout_ids })
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ impl<T: 'static> Element for Canvas<T> {
|
||||
) -> (crate::LayoutId, Self::RequestLayoutState) {
|
||||
let mut style = Style::default();
|
||||
style.refine(&self.style);
|
||||
let layout_id = cx.request_layout(&style, []);
|
||||
let layout_id = cx.request_layout(style.clone(), []);
|
||||
(layout_id, style)
|
||||
}
|
||||
|
||||
|
||||
@@ -1139,7 +1139,7 @@ impl Element for Div {
|
||||
.iter_mut()
|
||||
.map(|child| child.request_layout(cx))
|
||||
.collect::<SmallVec<_>>();
|
||||
cx.request_layout(&style, child_layout_ids.iter().copied())
|
||||
cx.request_layout(style, child_layout_ids.iter().copied())
|
||||
})
|
||||
});
|
||||
(layout_id, DivFrameState { child_layout_ids })
|
||||
|
||||
@@ -262,7 +262,7 @@ impl Element for Img {
|
||||
}
|
||||
}
|
||||
|
||||
cx.request_layout(&style, [])
|
||||
cx.request_layout(style, [])
|
||||
});
|
||||
(layout_id, ())
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ impl Element for List {
|
||||
let mut style = Style::default();
|
||||
style.refine(&self.style);
|
||||
cx.with_text_style(style.text_style().cloned(), |cx| {
|
||||
cx.request_layout(&style, None)
|
||||
cx.request_layout(style, None)
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ impl Element for Svg {
|
||||
) -> (LayoutId, Self::RequestLayoutState) {
|
||||
let layout_id = self
|
||||
.interactivity
|
||||
.request_layout(global_id, cx, |style, cx| cx.request_layout(&style, None));
|
||||
.request_layout(global_id, cx, |style, cx| cx.request_layout(style, None));
|
||||
(layout_id, ())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user