Skip to content

refactor: replace global clippy::pedantic allows with local annotations#79

Merged
StudentWeis merged 1 commit into
mainfrom
refactor/78-replace-global-clippy-allows
May 6, 2026
Merged

refactor: replace global clippy::pedantic allows with local annotations#79
StudentWeis merged 1 commit into
mainfrom
refactor/78-replace-global-clippy-allows

Conversation

@StudentWeis
Copy link
Copy Markdown
Owner

Summary

Replace seven blanket clippy::pedantic allows in Cargo.toml with localized #[allow(...)] annotations (each carrying a reason = "..."), and remove a few warnings entirely at the source. After this change cargo clippy --all-targets --all-features -- -D warnings is clean.

Linked Issue

Closes #78

Changes

  • Cargo.toml — drop the seven global clippy::pedantic allows so future code is lint-checked again.
  • Source-level fixes (no #[allow] left behind):
    • utils::clipboard_files — new hex_digit_value(u8) -> Option<u8> helper keeps percent-decoding in u8 end-to-end, eliminating the u32 -> u8 cast and the misleading try_from clippy suggestion.
    • updater::models — derive Eq on ReleaseInfo (UpdateStatus keeps PartialEq only because it carries an f32 progress value).
    • gui::board::records_list::metrics — add GRID_COLUMN_COUNT_F32 mirror constant so masonry layout math no longer casts at runtime.
  • Localized #[allow(... reason = "...")] for the remaining warnings, each documenting the safety invariant at that exact site:
    • gui::board::colorparse_alpha and float_channel_to_u8 are guarded to [0.0, 1.0] before scaling to u8.
    • gui::board::preview — image dimensions from the image crate fit comfortably in f32.
    • gui::board::records_list::metrics / masonry — line counts and column indices are bounded by small compile-time constants.
    • gui::board::settings_editor — opacity slider is bounded by MIN/MAX_OPACITY_PERCENT (0..=100).
    • gui::utils — physical pixel sizes fit in i32 on every supported platform.
    • updater::downloader — download progress only needs sub-percent accuracy.
    • gui::board::actionsgpui::actions! macro can't have Eq injected from outside; the generated items are wrapped in a private submodule scoped with #[allow(derive_partial_eq_without_eq)] and re-exported, so external usage is unchanged.
    • repository::time_index (tests only) — module-level allow for cast lints over small loop indices used in test fixtures.

Testing

  • scripts/precheck.sh passes locally (cargo fmt, cargo check, cargo clippy -- -D warnings, cargo test 421 passed, cargo machete, i18n / icons / themes checks)
  • No new tests needed — refactor is purely mechanical, no behavior change

Remove seven blanket allows from Cargo.toml [lints.clippy] and address each
remaining warning either at the source (preferred) or with a local
#[allow(...)] carrying a reason= annotation that documents why the cast or
derive is safe at that site.

Source-level fixes:
- utils::clipboard_files: keep percent-decoding in u8 end-to-end via a new
  hex_digit_value helper, eliminating the u32 -> u8 cast.
- updater::models: derive Eq on ReleaseInfo (UpdateStatus stays PartialEq
  because it carries an f32 progress value).
- gui::board::records_list::metrics: introduce GRID_COLUMN_COUNT_F32 mirror
  constant so masonry layout math no longer casts at runtime.

Refs #78
@StudentWeis StudentWeis merged commit f4a8bff into main May 6, 2026
8 checks passed
@StudentWeis StudentWeis deleted the refactor/78-replace-global-clippy-allows branch May 6, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: replace global clippy::pedantic allows with local annotations

1 participant