Fix a bunch of clippy lints #153

Merged
sugar700 merged 2 commits from martinthomson/enum-map:clippy-fix into master 2025-11-19 10:59:12 +01:00
Contributor

Mostly, these are pretty simple. I ran cargo clippy --fix, which made
a bunch of changes that are all OK.

There are a few that required manual intervention. I included a few
suppressions, with reasons. Other changes include: variable renames,
pass by reference rather than value, use of assert!() rather than
if _ { panic!() }, and probably the biggest change which is to have
the derive macro return a compile error rather than panicking if it
got bad input (that code is probably unreachable; I couldn't work
out how to hit it, but I've learned not to rely on my own ability to find errors).

Mostly, these are pretty simple. I ran `cargo clippy --fix`, which made a bunch of changes that are all OK. There are a few that required manual intervention. I included a few suppressions, with reasons. Other changes include: variable renames, pass by reference rather than value, use of `assert!()` rather than `if _ { panic!() }`, and probably the biggest change which is to have the derive macro return a compile error rather than panicking if it got bad input (that code is probably unreachable; I couldn't work out how to hit it, but I've learned not to rely on my own ability to find errors).
martinthomson force-pushed clippy-fix from 589b54a248
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
to 9560c1bd80
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
2025-02-28 04:11:07 +01:00
Compare
Owner

Please rebase your changes so that they could pass on CI.

Please rebase your changes so that they could pass on CI.
martinthomson force-pushed clippy-fix from 9560c1bd80
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
to a698e4a499 2025-09-04 06:29:09 +02:00
Compare
martinthomson left a comment
Author
Contributor

After rebase, the changes are more substantial (a few new lints in the 20 versions jumped).

Nothing here should be controversial aside from maybe my choice to add a test case function that simply executes the derive macro on nested types. That needed a dead_code suppression. If I missed something intentional regarding the scoping of that, it's fairly easy to tweak.

After rebase, the changes are more substantial (a few new lints in the 20 versions jumped). Nothing here should be controversial aside from maybe my choice to add a test case function that simply executes the derive macro on nested types. That needed a `dead_code` suppression. If I missed something intentional regarding the scoping of that, it's fairly easy to tweak.
@ -9,3 +8,3 @@
use syn::{DataEnum, Fields, FieldsNamed, FieldsUnnamed, Ident, Variant};
pub fn generate(name: Ident, data_enum: DataEnum) -> TokenStream {
use crate::type_length;
Author
Contributor

Let me know if you'd prefer that I revert the use statement stuff. I have rustfmt set with the imports_granularity=Crate,group_imports=StdExternalCrate, which I find to be really helpful,but it occasionally does rude things to other people's code.

Let me know if you'd prefer that I revert the use statement stuff. I have rustfmt set with the `imports_granularity=Crate,group_imports=StdExternalCrate`, which I find to be really helpful,but it occasionally does rude things to other people's code.
sugar700 scheduled this pull request to auto merge when all checks succeed 2025-09-05 10:41:07 +02:00
Owner

This needs to be rebased, as the other pull request was merged in.

This needs to be rebased, as the other pull request was merged in.
martinthomson force-pushed clippy-fix from a698e4a499 to a80dd4670e
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
2025-09-08 03:27:18 +02:00
Compare
Author
Contributor

Rebased. I added error documentation for try_from_fn and try_map to avoid a clippy warning there, but suppressed a panic docs warning on map (which uses unwrap() on Result<_, Infallible>; something that clippy can't quite work out).

Rebased. I added error documentation for `try_from_fn` and `try_map` to avoid a clippy warning there, but suppressed a panic docs warning on `map` (which uses `unwrap()` on `Result<_, Infallible>`; something that clippy can't quite work out).
Remove redundant warning
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
968d6e2503
sugar700 merged commit 8b8659231d into master 2025-11-19 10:59:12 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sugar700/enum-map!153
No description provided.