chore: apply clippy suggestions
This commit is contained in:
parent
34f55d6720
commit
a27bb5e05d
34 changed files with 116 additions and 146 deletions
|
|
@ -97,7 +97,7 @@ impl Default for MenuBarStateInner {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn menu_roots_children<Message>(menu_roots: &Vec<MenuTree<Message>>) -> Vec<Tree>
|
||||
pub(crate) fn menu_roots_children<Message>(menu_roots: &[MenuTree<Message>]) -> Vec<Tree>
|
||||
where
|
||||
Message: Clone + 'static,
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ where
|
|||
}
|
||||
|
||||
#[allow(invalid_reference_casting)]
|
||||
pub(crate) fn menu_roots_diff<Message>(menu_roots: &mut Vec<MenuTree<Message>>, tree: &mut Tree)
|
||||
pub(crate) fn menu_roots_diff<Message>(menu_roots: &mut [MenuTree<Message>], tree: &mut Tree)
|
||||
where
|
||||
Message: Clone + 'static,
|
||||
{
|
||||
|
|
@ -381,7 +381,7 @@ where
|
|||
let surface_action = self.on_surface_action.as_ref().unwrap();
|
||||
let old_active_root = my_state
|
||||
.inner
|
||||
.with_data(|state| state.active_root.get(0).copied());
|
||||
.with_data(|state| state.active_root.first().copied());
|
||||
|
||||
// if position is not on menu bar button skip.
|
||||
let hovered_root = layout
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ impl MenuState {
|
|||
pub(crate) struct Menu<'b, Message: std::clone::Clone> {
|
||||
pub(crate) tree: MenuBarState,
|
||||
// Flattened menu tree
|
||||
pub(crate) menu_roots: Cow<'b, Vec<MenuTree<Message>>>,
|
||||
pub(crate) menu_roots: Cow<'b, [MenuTree<Message>]>,
|
||||
pub(crate) bounds_expand: u16,
|
||||
/// Allows menu overlay items to overlap the parent
|
||||
pub(crate) menu_overlays_parent: bool,
|
||||
|
|
@ -740,7 +740,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
|||
let styling = theme.appearance(&self.style);
|
||||
let roots = active_root.iter().skip(1).fold(
|
||||
&self.menu_roots[active_root[0]].children,
|
||||
|mt, next_active_root| (&mt[*next_active_root].children),
|
||||
|mt, next_active_root| &mt[*next_active_root].children,
|
||||
);
|
||||
let indices = state.get_trimmed_indices(self.depth).collect::<Vec<_>>();
|
||||
state.menu_states[if self.is_overlay { 0 } else { self.depth }..=if self.is_overlay {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ impl<Message: Clone + 'static> MenuTree<Message> {
|
|||
});
|
||||
|
||||
mt.children.iter().for_each(|c| {
|
||||
rec(&c, flat);
|
||||
rec(c, flat);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue