Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clippy warnings #529

Merged
merged 5 commits into from
Feb 7, 2025
Merged

fix clippy warnings #529

merged 5 commits into from
Feb 7, 2025

Conversation

joseluis
Copy link
Contributor

@joseluis joseluis commented Feb 7, 2025

This reduces the number of warnings from 943 between all platforms to just 22. Leaving the ones related mostly with ambiguous unsafe code, which now stands out more, instead of being buried under a pile.

I've been careful to apply clippy suggestions that increases clarity, while allowing the lints that made more sense otherwise. But please feel free to comment and suggest anything done differently.

to check run, e.g.:

cargo clippy --target x86_64-unknown-linux-gnu
cargo clippy --target armv7-unknown-linux-gnueabihf
cargo clippy --target x86_64-pc-windows-gnu
cargo clippy --target x86_64-apple-darwin
cargo clippy --target aarch64-apple-ios
cargo clippy --target wasm32-unknown-unknown

Notes:
- Warnings related to unsafe code has not been touched.
- The number of warnings has been reduced from 527 to 3.
- A few lints has been allowed globally, for convenience.

Fixes:
- fixed macros to use `$` in `$crate::`.
- broke some long lines for readability.
- solved some unneded mutable references.
- simplified unneeded vecs for arrays.
- simplified unneeded explicit returns.
- simplified unneeded redundant conversions.
- simplified fn signatures returning unit type.
- simplified verbose comparisons with booleans.
- simplified unnecessary explicit dereferences.
- allowed some functions with too many args.
- implemented `Default` for several items.
- ...among others.
- Warnings related to unsafe code has not been touched.
- The number of warnings has been reduced from 381 to 7 errors (denied lints).

Fixes:
- replaced unmaintained objc crate with fork SSheldon/rust-objc#125.
  - Ideally it would be replaced with https://github.com/madsmtm/objc2 but that'd be too much work.
- simplified zero pointers and redundant casts and clones.
- fixed slow zero-filling vector initialization.
- simplified unneeded explicit returns.
- simplified unnecessary lifetimes.
- ...among others.
- Warnings related to unsafe code has not been touched.
- The number of warnings has been reduced from 19 to 0.

Fixes:
- simplified redundant casts.
- simplified bool comparisons.
- simplified unnecessary lifetimes.
- simplified unneeded explicit returns.
- simplified unnecessary map_or.
- made transmute types explict.
- ...among others.
- Warnings related to unsafe code has not been touched.
- The number of warnings has been reduced from 7 to 3 errors (denied lints).

- made thread_local initializer const.
- simplified unneded explicit returns.
- reformat confusing else if.
- Warnings related to unsafe code has not been touched.
- The number of warnings has been reduced from 9 to 2 + 7 errors (denied lints).

- simplified manual range contains.
- simplified unneded explicit returns.
- simplified destructuring with match to if let.
@not-fl3 not-fl3 merged commit ec99dab into not-fl3:master Feb 7, 2025
11 checks passed
@joseluis joseluis deleted the feat-fix-warnings branch February 8, 2025 09:19
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.

2 participants