Skip to content

refactor: resolve strict clippy diagnostics across lib and wayland modules - #38

Open
guylamar2006 wants to merge 1 commit into
Supreeeme:mainfrom
guylamar2006:clippy-fixes
Open

guylamar2006 wants to merge 1 commit into
Supreeeme:mainfrom
guylamar2006:clippy-fixes

Conversation

@guylamar2006

@guylamar2006 guylamar2006 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

This pull request primarily refactors code in src/lib.rs and src/wayland.rs to improve code style, update usage of synchronization primitives, and clarify type conversions. The main changes include replacing once_cell::sync::Lazy with std::sync::LazyLock, simplifying type conversions, and making minor improvements to iterator and trait usage.

Refactoring and Modernization:

  • Replaced once_cell::sync::Lazy with std::sync::LazyLock for the static DEVICE initialization in src/lib.rs, aligning with modern Rust standard library features.
  • Updated the conversion of boolean values to integers in several FFI functions to use i32::from(is_press) instead of is_press as i32, making the conversion explicit and idiomatic. [1] [2] [3] [4]

Code Style and Clarity:

  • Changed for output in data.wl_outputs.iter() to for output in &data.wl_outputs in src/wayland.rs for improved clarity and idiomatic iteration.
  • In trait implementations for Dispatch, clarified parameter usage and type annotations for better readability and maintainability. [1] [2]
  • Made the use MouseButtons::* import more explicit by listing individual variants, improving code clarity.

…dules

Fixes multiple strict lint warnings to align with a zero-warning profile:
* clippy::non_std_lazy_statics: Replaces the explicit external `Lazy` type with standard `std::sync::LazyLock`.
* clippy::as_conversions: Migrates primitive boolean casts (`is_press as i32`) to lossless `i32::from` conversions.
* clippy::enum_glob_use: Replaces the `MouseButtons::*` glob pattern with explicit variant imports in `TryFrom`.
* clippy::explicit_iter_loop: Changes `.iter()` calls on structural collections to standard implicit reference loops (`&data.wl_outputs`).
* clippy::ignored_unit_patterns: Updates the `_` unit type discards to explicit `()` matching.
* clippy::type_complexity: Standardizes trait `QueueHandle<OutputData>` bounds using the `Self` alias context.

fix return statements
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.

1 participant