Add lint:rust command and resolve various clippy linting warnings - #414
Open
mrxz wants to merge 3 commits into
Open
Add lint:rust command and resolve various clippy linting warnings#414mrxz wants to merge 3 commits into
lint:rust command and resolve various clippy linting warnings#414mrxz wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently only the TypeScript code is automatically linted and formatted, whereas the Rust code is left as-is. Ideally we'd apply the same automatic process to both. This helps avoid common mistakes/pitfalls and ensures consistent code formatting. Related #370
This PR introduces a
lint:rustscript to easily execute clippy. This is not included in the pre-commit hook nor in any of the CI pipelines yet. In order for that to be useful, all pre-existing linting warnings should be resolved (either fixed or explicitly allowed).Additionally various linter warnings have been resolved. Though the following rules have been skipped as they (subjectively) reduce the readability or are non-trivial:
+ 0is nice for symmetry.returnThe
needless_range_loopis interesting in the regard that it can help avoid bound checks. Though quite often the index is still needed for offset in the source or destination vectors. The resulting code would not always be as easy to read, especially when the iterated collection is the destination and not the source.In any case, I do think this is a good start. Follow up steps would be to settle on which linting rules to include and which to exclude as well as integrating it in the CI pipelines + commit hook (preferably only if/when rust code has changed given how slow these Rust tools are).