Clippy and test-target lints: redundant must_use, type aliases for complex types, boxed large variants, argument structs, struct-update initialisers, deprecated egui calls, unused imports and dead code; the swatch library's reorder test runs as a trial

This commit is contained in:
aiongg
2026-11-16 02:30:55 +00:00
parent fd5490dc3b
commit cc00dbd368
78 changed files with 252 additions and 212 deletions
@@ -1025,7 +1025,7 @@ pub fn set_param_field(params: &[Param], fields: &mut DialogFields, field: &str,
return Err(FieldRefusal::Inactive.message(field));
}
let writes = if companion(param) {
Some(vec![(field.to_owned(), Some(FieldValue::Json(value.clone())).filter(|_| !value.is_null()))])
Some(vec![(field.to_owned(), (!value.is_null()).then_some(FieldValue::Json(value.clone())))])
} else if param.key != field {
value.as_str().map(|unit| vec![(field.to_owned(), Some(FieldValue::Text(unit.to_owned())))])
} else if matches!(param.kind, ParamKind::Files { .. }) {
@@ -401,7 +401,6 @@ impl<'a> FormatOptionsDialog<'a> {
/// Offers the TIFF rows of a document: Discard Layers when it has `layered`, Save Transparency when it is
/// `transparent`, and the layered-file note with Don't show again when `layer_note` is set (while the layers are
/// kept). Without this call the dialog offers every row.
#[must_use]
pub fn tiff_document(mut self, layered: bool, transparent: bool, layer_note: bool) -> Self {
self.tiff = TiffDocument { layered, transparent, layer_note };
self
@@ -643,7 +643,7 @@ impl HostedGuideLayoutDialog {
impl StackDialog for HostedGuideLayoutDialog {
type Result = GuideLayoutResult;
/// Answers what OK answers: the guide list of [`layout_guides`]; `None` while the layout is invalid.
/// Answers what OK answers: the guide list of `layout_guides`; `None` while the layout is invalid.
fn confirm(&mut self, _ctx: &egui::Context) -> Option<Self::Result> {
let GuideLayoutDialog { units, document, artboards, existing, first_key, .. } = (self.build)(Bind::bound(&mut self.values));
let values = self.values;
@@ -93,7 +93,6 @@ impl<'a> ReportDialog<'a> {
/// Plain `lines` shown as the notes, in place of ones built with [`ReportNote`]: each line is selectable text,
/// and Copy hands them back as they are.
#[must_use]
pub fn lines(mut self, lines: Vec<Label>) -> Self {
self.lines = lines;
self
@@ -137,6 +137,9 @@ impl Outcome for HistoryPanelOutput {
}
/// The row a context menu was asked for; it lives in the panel's stack memory while the menu is open.
/// Whether a row may be deleted.
type DeletePredicate<'a> = Box<dyn Fn(&HistoryKey) -> bool + 'a>;
#[derive(Clone, Copy, Default)]
struct MenuTarget(Option<HistoryKey>);
@@ -157,7 +160,7 @@ pub struct HistoryPanel<'a> {
source: Option<HistoryKey>,
has_source: bool,
thumbs: Option<(&'a Thumbnails<u64>, &'a dyn ThumbSource<u64>)>,
can_delete: Option<Box<dyn Fn(&HistoryKey) -> bool + 'a>>,
can_delete: Option<DeletePredicate<'a>>,
footer: HistoryFooter,
reveal: Option<HistoryKey>,
rename: Option<u64>,
@@ -182,7 +185,6 @@ impl<'a> HistoryPanel<'a> {
}
/// Shows the source column and marks the row that is the source of the history brush.
#[must_use]
pub fn source(mut self, source: Option<HistoryKey>) -> Self {
self.source = source;
self.has_source = true;
@@ -190,42 +192,36 @@ impl<'a> HistoryPanel<'a> {
}
/// Shows the pictures of the snapshot rows from `source`.
#[must_use]
pub fn thumbnails(mut self, thumbnails: &'a Thumbnails<u64>, source: &'a dyn ThumbSource<u64>) -> Self {
self.thumbs = Some((thumbnails, source));
self
}
/// Which rows the Delete button and key take; the others refuse. Without it every row is taken.
#[must_use]
pub fn can_delete(mut self, can: impl Fn(&HistoryKey) -> bool + 'a) -> Self {
self.can_delete = Some(Box::new(can));
self
}
/// Which footer buttons show.
#[must_use]
pub fn footer(mut self, footer: HistoryFooter) -> Self {
self.footer = footer;
self
}
/// Scrolls to `key` and shows it.
#[must_use]
pub fn reveal(mut self, key: HistoryKey) -> Self {
self.reveal = Some(key);
self
}
/// Opens the rename field of the snapshot `snapshot`.
#[must_use]
pub fn start_rename(mut self, snapshot: u64) -> Self {
self.rename = Some(snapshot);
self
}
/// Whether the panel takes input.
#[must_use]
pub fn enabled(mut self, enabled: bool) -> Self {
self.enabled = enabled;
self