craft-ui-contract: clippy 1.99 (if_same_then_else, unnecessary_lazy_evaluations, expect_used in the icon trials)

This commit is contained in:
aiongg
2026-11-16 01:58:30 +00:00
parent 4a65e13b74
commit f3907ceb3b
3 changed files with 3 additions and 4 deletions
@@ -473,9 +473,7 @@ pub(crate) fn run(state: &mut TextState, mut input: AdapterIn<'_>) -> AdapterOut
if input.options.multiline() {
input.intents.take(Intent::SubmitForce);
}
} else if separated {
state.end = Some(End::Separator);
} else if stepped && state.end.is_none() {
} else if separated || (stepped && state.end.is_none()) {
state.end = Some(End::Separator);
} else if shown.lost_focus && !input.held && state.draft.is_some() && state.end.is_none() {
state.end = Some(End::Blur);
+1 -1
View File
@@ -132,7 +132,7 @@ pub(crate) fn begin(ctx: &Context) {
}
// A value control that owns the running gesture hears its end without a timer of its own: a pass at the gap.
let value_owner = state.gesture.owner.is_some_and(|owner| state.last.iter().any(|taker| taker.owner == owner && taker.value));
(value_owner && state.gesture.runs(now)).then(|| state.gesture.last + GESTURE_GAP - now)
(value_owner && state.gesture.runs(now)).then_some(state.gesture.last + GESTURE_GAP - now)
});
if let Some(seconds) = wake {
repaint::request_after(ctx, viewport, seconds.max(0.0));
@@ -23,6 +23,7 @@ fn icon(name: &'static str) -> Option<SvgIcon> {
SvgIcon::of(&tokens, Direction::Ltr, 24.0, &IconId::from(std::borrow::Cow::Borrowed(name)), IconSet::default(), Mirror::Auto)
}
#[expect(clippy::expect_used, reason = "the trials name icons of the built-in set; a missing one fails the trial")]
fn mask(name: &'static str) -> ColorImage {
icon(name).expect("the name resolves").mask(24.0, 1.0)
}