Lints: story facts initialisers, doc links, path field last edit

This commit is contained in:
aiongg
2026-11-14 01:14:54 +00:00
parent 1414789132
commit d08c97c8c5
7 changed files with 22 additions and 19 deletions
+6 -5
View File
@@ -114,11 +114,12 @@ impl Outcome for ColorPickerOutput {
#[cfg(feature = "screen-testing")]
fn story_facts(&self) -> craft_ui::testing::StoryOutput {
let mut facts = craft_ui::testing::StoryOutput::default();
facts.id = Some(self.response.id);
facts.clicked = craft_ui::contract::clicked(&self.response);
facts.edits = self.events.iter().filter_map(craft_ui::testing::EditKind::of).collect();
facts
craft_ui::testing::StoryOutput {
id: Some(self.response.id),
clicked: craft_ui::contract::clicked(&self.response),
edits: self.events.iter().filter_map(craft_ui::testing::EditKind::of).collect(),
..Default::default()
}
}
}
+10 -9
View File
@@ -84,15 +84,16 @@ impl Outcome for ColorReadoutOutput {
#[cfg(feature = "screen-testing")]
fn story_facts(&self) -> craft_ui::testing::StoryOutput {
let mut facts = craft_ui::testing::StoryOutput::default();
facts.id = Some(self.response.id);
facts.edits = self
.events
.iter()
.filter_map(craft_ui::testing::EditKind::of)
.chain(self.channel.iter().filter_map(|edit| craft_ui::testing::EditKind::of(&edit.event)))
.collect();
facts
craft_ui::testing::StoryOutput {
id: Some(self.response.id),
edits: self
.events
.iter()
.filter_map(craft_ui::testing::EditKind::of)
.chain(self.channel.iter().filter_map(|edit| craft_ui::testing::EditKind::of(&edit.event)))
.collect(),
..Default::default()
}
}
}
+1 -1
View File
@@ -105,7 +105,7 @@ impl<'a> PathField<'a> {
};
Some((after, event))
})
.last();
.next_back();
let landed = typed.or_else(|| {
answered.map(|path| {
let event = EditEvent::set(Mixed::Same(before.clone()), path.clone(), label.as_str().into(), None);
+1 -1
View File
@@ -559,7 +559,7 @@ impl Keymap {
}
/// Whether both commands of `conflict` have its chord among their defaults, so they share it by
/// design and [`Keymap::clashing`] leaves them out.
/// design and `Keymap::clashing` leaves them out.
pub fn twins_in(&self, conflict: &Conflict) -> bool {
let (Some(i), Some(j)) = (self.find(&conflict.a.0), self.find(&conflict.b.0)) else { return false };
self.twins(i, j, conflict.chord)
+1 -1
View File
@@ -83,7 +83,7 @@ const PC_EDITING: &[Chord] = &[
/// The chords with modifiers that edit text on `platform`, as effective chords: undo, redo,
/// select all, the clipboard, and moving and deleting by word, line and text. While typing they go to the text
/// field under every [`TypingRule`]; only a binding in an active context takes one. Plain keys
/// field under every [`TypingRule`](crate::TypingRule); only a binding in an active context takes one. Plain keys
/// (arrows, Home, End, Backspace, Delete, with or without Shift) are not listed, since every rule
/// holds them already.
pub fn text_editing_chords(platform: Platform) -> &'static [Chord] {
+1 -1
View File
@@ -18,7 +18,7 @@ pub enum FadeShape {
impl FadeShape {
pub const ALL: [FadeShape; 5] = [FadeShape::Linear, FadeShape::EqualPower, FadeShape::SCurve, FadeShape::Exponential, FadeShape::Logarithmic];
/// Fade-in gain at `t` ∈ [0,1] (fade-outs use `gain(1 - t)`).
/// Fade-in gain at `t` in `[0, 1]` (fade-outs use `gain(1 - t)`).
pub fn gain(self, t: f32) -> f32 {
let t = if t.is_nan() { 0.0 } else { t.clamp(0.0, 1.0) };
match self {
+2 -1
View File
@@ -170,7 +170,8 @@ fn a_settled_leaf_that_read_an_input_besides_its_room_runs_one_pass() {
},
);
};
let shows: [(&str, &dyn Fn(&mut Ui)); 2] = [("menu", &menu), ("title bar", &bar)];
type Show<'a> = (&'a str, &'a dyn Fn(&mut Ui));
let shows: [Show; 2] = [("menu", &menu), ("title bar", &bar)];
for (name, show) in shows {
let mut frames = Frames::new();
frames.idle(4, show);