fix clippy issues
This commit is contained in:
@@ -21,10 +21,12 @@ pub trait ContextMenuExt: ParentElement + Sized {
|
||||
impl<E> ContextMenuExt for Stateful<E> where E: ParentElement {}
|
||||
impl<E> ContextMenuExt for Focusable<E> where E: ParentElement {}
|
||||
|
||||
type Menu<M> = Option<Box<dyn Fn(PopupMenu, &mut ViewContext<M>) -> PopupMenu + 'static>>;
|
||||
|
||||
/// A context menu that can be shown on right-click.
|
||||
pub struct ContextMenu {
|
||||
id: ElementId,
|
||||
menu: Option<Box<dyn Fn(PopupMenu, &mut ViewContext<PopupMenu>) -> PopupMenu + 'static>>,
|
||||
menu: Menu<PopupMenu>,
|
||||
anchor: AnchorCorner,
|
||||
}
|
||||
|
||||
@@ -99,13 +101,17 @@ impl Element for ContextMenu {
|
||||
id: Option<&gpui::GlobalElementId>,
|
||||
cx: &mut WindowContext,
|
||||
) -> (gpui::LayoutId, Self::RequestLayoutState) {
|
||||
let mut style = Style::default();
|
||||
// Set the layout style relative to the table view to get same size.
|
||||
style.position = Position::Absolute;
|
||||
style.flex_grow = 1.0;
|
||||
style.flex_shrink = 1.0;
|
||||
style.size.width = relative(1.).into();
|
||||
style.size.height = relative(1.).into();
|
||||
let style = Style {
|
||||
position: Position::Absolute,
|
||||
flex_grow: 1.0,
|
||||
flex_shrink: 1.0,
|
||||
size: gpui::Size {
|
||||
width: relative(1.).into(),
|
||||
height: relative(1.).into(),
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let anchor = self.anchor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user