yoda: warning cleanup sweep (dead code + clippy --fix) (squashed)
Squash of 4 yoda commits: -84437e21yoda: libcosmic-yoda dead-code purge (14->0 warnings) -999db0a4yoda: cosmic-theme cleanup (4->0 warnings) — workspace at 0 warnings total -4743bb8eyoda: cargo clippy --fix on libcosmic-yoda (115->33 warnings) -675f3b59chore: reduce local stack warnings
This commit is contained in:
parent
f9ff7496f3
commit
03f3769373
36 changed files with 181 additions and 219 deletions
|
|
@ -48,6 +48,7 @@ impl Axis {
|
|||
/// padding and alignment to the items as needed.
|
||||
///
|
||||
/// It returns a new layout [`Node`].
|
||||
#[allow(dead_code)] // kept as public helper; not currently called by libcosmic
|
||||
pub fn resolve<'a, E, Message, Renderer>(
|
||||
axis: &Axis,
|
||||
renderer: &Renderer,
|
||||
|
|
@ -246,7 +247,7 @@ pub fn resolve_wrapper<'a, Message>(
|
|||
if align_items == Alignment::Center {
|
||||
let mut fill_cross = axis.cross(limits.min());
|
||||
|
||||
for (child, tree) in items.into_iter().zip(tree.iter_mut()) {
|
||||
for (child, tree) in items.iter_mut().zip(tree.iter_mut()) {
|
||||
let c_size = child.size();
|
||||
let cross_fill_factor = match axis {
|
||||
Axis::Horizontal => c_size.height,
|
||||
|
|
@ -269,7 +270,7 @@ pub fn resolve_wrapper<'a, Message>(
|
|||
cross = fill_cross;
|
||||
}
|
||||
|
||||
for (i, (child, tree)) in items.into_iter().zip(tree.iter_mut()).enumerate() {
|
||||
for (i, (child, tree)) in items.iter_mut().zip(tree.iter_mut()).enumerate() {
|
||||
let c_size = child.size();
|
||||
let fill_factor = match axis {
|
||||
Axis::Horizontal => c_size.width,
|
||||
|
|
@ -312,7 +313,7 @@ pub fn resolve_wrapper<'a, Message>(
|
|||
|
||||
let remaining = available.max(0.0);
|
||||
|
||||
for (i, (child, tree)) in items.into_iter().zip(tree.iter_mut()).enumerate() {
|
||||
for (i, (child, tree)) in items.iter_mut().zip(tree.iter_mut()).enumerate() {
|
||||
let c_size = child.size();
|
||||
let fill_factor = match axis {
|
||||
Axis::Horizontal => c_size.width,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ pub(crate) struct MenuBarStateInner {
|
|||
pub(crate) tree: Tree,
|
||||
pub(crate) popup_id: HashMap<window::Id, window::Id>,
|
||||
pub(crate) pressed: bool,
|
||||
pub(crate) bar_pressed: bool,
|
||||
pub(crate) view_cursor: Cursor,
|
||||
pub(crate) open: bool,
|
||||
pub(crate) active_root: Vec<usize>,
|
||||
|
|
@ -87,7 +86,6 @@ impl Default for MenuBarStateInner {
|
|||
vertical_direction: Direction::Positive,
|
||||
menu_states: Vec::new(),
|
||||
popup_id: HashMap::new(),
|
||||
bar_pressed: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,14 +162,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_mut_or_default<T: Default>(vec: &mut Vec<T>, index: usize) -> &mut T {
|
||||
if index < vec.len() {
|
||||
&mut vec[index]
|
||||
} else {
|
||||
vec.resize_with(index + 1, T::default);
|
||||
&mut vec[index]
|
||||
}
|
||||
}
|
||||
|
||||
/// A `MenuBar` collects `MenuTree`s and handles all the layout, event processing, and drawing.
|
||||
#[allow(missing_debug_implementations)]
|
||||
|
|
@ -605,14 +595,12 @@ where
|
|||
.with_data(|d| !d.open && !d.active_root.is_empty());
|
||||
|
||||
let open = my_state.inner.with_data_mut(|state| {
|
||||
if reset {
|
||||
if let Some(popup_id) = state.popup_id.get(&self.window_id).copied() {
|
||||
if let Some(handler) = self.on_surface_action.as_ref() {
|
||||
if reset
|
||||
&& let Some(popup_id) = state.popup_id.get(&self.window_id).copied()
|
||||
&& let Some(handler) = self.on_surface_action.as_ref() {
|
||||
shell.publish((handler)(crate::surface::Action::DestroyPopup(popup_id)));
|
||||
state.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
state.open
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1522,14 +1522,13 @@ where
|
|||
.is_some_and(|i| *i != new_index && !active_menu[*i].children.is_empty());
|
||||
|
||||
#[cfg(all(feature = "multi-window", feature = "wayland", target_os = "linux", feature = "surface-message"))]
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove {
|
||||
if let Some(id) = state.popup_id.remove(&menu.window_id) {
|
||||
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) && remove
|
||||
&& let Some(id) = state.popup_id.remove(&menu.window_id) {
|
||||
state.active_root.truncate(menu.depth + 1);
|
||||
shell.publish((menu.on_surface_action.as_ref().unwrap())({
|
||||
crate::surface::action::destroy_popup(id)
|
||||
}));
|
||||
}
|
||||
}
|
||||
let item = &active_menu[new_index];
|
||||
// set new index
|
||||
let old_index = last_menu_state.index.replace(new_index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue