mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
ui-shell: clippy 1.100 clean: the start screen's app section type named; no must_use on a builder of a must_use type; test types named, slice from_ref
This commit is contained in:
@@ -162,6 +162,9 @@ impl Outcome for StartOutput {
|
||||
}
|
||||
}
|
||||
|
||||
/// An app's own section of the start screen: its title and its body.
|
||||
type AppSection<'a> = (Label, RefCell<&'a mut dyn FnMut(&mut Ui)>);
|
||||
|
||||
/// The start screen, shown in a shell's body when no document is open.
|
||||
///
|
||||
/// - **Layout.** New and Open (the first Tab stops), then Recent with the view switch and the sort, Pinned Folders
|
||||
@@ -214,7 +217,7 @@ pub struct StartScreen<'a> {
|
||||
#[prop(into)]
|
||||
drop_hint: Option<Label>,
|
||||
/// One app section, drawn after Recent and Pinned Folders and before Templates.
|
||||
section: Option<(Label, RefCell<&'a mut dyn FnMut(&mut Ui)>)>,
|
||||
section: Option<AppSection<'a>>,
|
||||
/// How the page is laid out.
|
||||
#[prop]
|
||||
layout: StartLayout,
|
||||
@@ -326,7 +329,6 @@ impl<'a> StartScreen<'a> {
|
||||
|
||||
/// One app section titled `title`, drawn as a fixed section after Recent and Pinned Folders and before Templates.
|
||||
/// `body` may run more than once in a pass: the rail measures it.
|
||||
#[must_use]
|
||||
pub fn section(mut self, title: impl Into<Label>, body: &'a mut dyn FnMut(&mut Ui)) -> Self {
|
||||
self.section = Some((title.into(), RefCell::new(body)));
|
||||
self
|
||||
|
||||
@@ -79,13 +79,16 @@ fn plain_templates() -> Vec<Template> {
|
||||
]
|
||||
}
|
||||
|
||||
/// An app section a story adds: its title and its body.
|
||||
type AppSection<'a> = (&'a str, &'a mut dyn FnMut(&mut Ui));
|
||||
|
||||
/// What a story passes besides its lists.
|
||||
#[derive(Default)]
|
||||
struct Extras<'a> {
|
||||
source: Option<&'a FakeThumbSource<ThumbKey>>,
|
||||
links: &'a [StartLink],
|
||||
drop_hint: Option<&'a str>,
|
||||
section: Option<(&'a str, &'a mut dyn FnMut(&mut Ui))>,
|
||||
section: Option<AppSection<'a>>,
|
||||
}
|
||||
|
||||
fn screen(
|
||||
|
||||
@@ -289,7 +289,7 @@ fn a_command_shown_in_view_is_found_and_one_under_a_layer_is_not() {
|
||||
let seen = RefCell::new(Vec::new());
|
||||
let mut show = |ui: &mut Ui| {
|
||||
seen.borrow_mut().push(shown(ui.ctx(), &command));
|
||||
holds(ui.ctx(), ui.layer_id(), rect, &[command.clone()], "Quick".into());
|
||||
holds(ui.ctx(), ui.layer_id(), rect, std::slice::from_ref(&command), "Quick".into());
|
||||
};
|
||||
let mut frames = Frames::new();
|
||||
frames.idle(3, &mut show);
|
||||
|
||||
@@ -749,7 +749,8 @@ fn select_list(ui: &mut Ui) {
|
||||
/// status bar is never covered.
|
||||
#[trial]
|
||||
fn popups_stop_above_the_bottom_slots_in_each_window() {
|
||||
let cases: [(&str, fn(&mut Ui)); 3] = [("Open", button_menu), ("File", menu_bar), ("Pick", select_list)];
|
||||
type Case = (&'static str, fn(&mut Ui));
|
||||
let cases: [Case; 3] = [("Open", button_menu), ("File", menu_bar), ("Pick", select_list)];
|
||||
for (opener, body) in cases {
|
||||
let (mut fixture, slot) = shell_with_status(body);
|
||||
let opener_node = fixture.by_label(opener).unwrap_or_else(|| panic!("the opener {opener:?} shows"));
|
||||
|
||||
Reference in New Issue
Block a user