Layers: keep clippy happy (menu item type, no unreachable in tests)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BFlat 2026-10-07 23:06:31 +07:00
parent ccdb4d89c1
commit 0648e99fc4
2 changed files with 5 additions and 2 deletions

View File

@ -187,7 +187,7 @@ fn layer_options_validate_and_template_locks_and_dims() {
}
let color = |s: &Session| match node(s, layer).kind {
NodeKind::Layer { color, .. } => color,
_ => unreachable!(),
_ => panic!("not a layer"),
};
run(&mut s, "layer.setProps", json!({"id": layer.0, "color": "red"}));
assert_eq!(color(&s), LayerColor::Preset(1));

View File

@ -748,6 +748,9 @@ fn thumb(ui: &Ui, n: &Node, r: egui::Rect) {
});
}
/// A panel menu item: label, command, params, enabled, checked.
type MenuItem<'a> = (&'a str, &'a str, Value, bool, bool);
/// The Layers panel's (≡) menu.
pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
let Some(st) = app.session.active() else { return };
@ -772,7 +775,7 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
all_layers.push(n);
}
});
let mut items: Vec<Option<(&str, &str, Value, bool, bool)>> = vec![
let mut items: Vec<Option<MenuItem>> = vec![
Some(("New Layer…", "ui.newLayer", json!({}), true, false)),
Some(("New Sublayer…", "ui.newLayer", json!({"sublayer": true}), current.is_some(), false)),
Some(("Duplicate Selection", "layer.duplicate", json!({}), !targets.is_empty(), false)),