Skip to content

Fix clippy lints#44

Merged
Axect merged 15 commits intoAxect:masterfrom
JSorngard:clippy
Apr 25, 2025
Merged

Fix clippy lints#44
Axect merged 15 commits intoAxect:masterfrom
JSorngard:clippy

Conversation

@JSorngard
Copy link
Copy Markdown
Contributor

@JSorngard JSorngard commented Apr 9, 2025

This PR goes through all the lint warnings generated by cargo clippy discovered in #41, and either follows the suggestion or does something more appropriate to fix them.

Overview of changes

  • Some return x; at the end of a block have been changed to just x.
  • Manual checks for if a value is contained in a range have been replaced by the contains function on that range.
  • A bunch of constant float literals have had underscores inserted as spacers, e.g. "1.234567890" has been changed to "1.234_567_890".
  • Usages of the constant float literal "1.1283791670955126" has been replaced with FRAC_2_SQRT_PI from the core::f64::consts module.
  • Loops over a range that only use the value to index into a container have been changed to loops over the container values themselves.
  • Removed some unnecessary parenthesis.
  • Two doc comments were converted into normal comments, as they did not document the constant they decorated, but several constants.
  • Very large consts have been converted into statics.

@JSorngard
Copy link
Copy Markdown
Contributor Author

JSorngard commented Apr 9, 2025

It is completely reasonable to object to some of these changes, in which case I will undo them, and we can allow the clippy lint that suggests them.
I am in particular uncertain about the lint about inserting underscores, as it seems to trigger for a somewhat random selection of constants.

@Axect
Copy link
Copy Markdown
Owner

Axect commented Apr 25, 2025

Thank you so much for putting in all this effort to address the clippy lints! We really appreciate your contribution. Great work!

Regarding your points about potential objections and the offer to revert changes: thanks for considering that and being open to feedback. For now, let's stick with following the clippy suggestions, including the underscore insertions. We can follow the lint rules for the time being. If they turn out to be genuinely inconvenient or problematic as we continue working, we can definitely revisit and adjust them later. Thanks for bringing it up!

@Axect Axect merged commit b8a37ca into Axect:master Apr 25, 2025
1 check passed
Axect added a commit that referenced this pull request Apr 25, 2025
- Enhance CI (#41, #42, #43, #44)
- Add all branches of the complex Lambert W (#40, #45)
@JSorngard JSorngard deleted the clippy branch April 25, 2025 05:27
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