Skip to content

Add clippy to lint rust code#186

Merged
seddonym merged 4 commits intopython-grimp:masterfrom
Peter554:add-clippy
Feb 8, 2025
Merged

Add clippy to lint rust code#186
seddonym merged 4 commits intopython-grimp:masterfrom
Peter554:add-clippy

Conversation

@Peter554
Copy link
Collaborator

@Peter554 Peter554 commented Feb 8, 2025

Clippy is a very popular linter for rust code. The default configuration is good. Clippy can help us to catch issues related to code correctness, style and performance. It's often possible to apply automatic fixes via the --fix flag.

We don't need to run the rust tests for every single python version
in the matrix.
Clippy is a very popular linter for rust code.
The default condifuration is good. Clippy can help us to
catch issues related to code correctness, style and performance.

https://doc.rust-lang.org/clippy/index.html
Most of the time clippy warnings are there for a reason and
it's best to restructure the code to avoid them. Clippy
can often apply automatic fixes with the `--fix` option.

In the rare case that clippy is wrong, lints can be ignored
at the module/function level.
Comment on lines +12 to +13
check_python:
name: Check Python ${{ matrix.python-version }}, ${{ matrix.os }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone for the name "check" here rather than "test", since we're also running black, mypy, flake8 etc.

working-directory: ./rust
- name: Run linter (clippy)
run: cargo clippy --all-targets --all-features
run: cargo clippy --all-targets --all-features -- -D warnings
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are currently no violations - mainly because I've been using clippy when developing the rust graph on my branch.

@Peter554 Peter554 force-pushed the add-clippy branch 2 times, most recently from fdd53c2 to fa9e0c4 Compare February 8, 2025 16:36
@Peter554 Peter554 marked this pull request as ready for review February 8, 2025 16:43
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 8, 2025

CodSpeed Performance Report

Merging #186 will not alter performance

Comparing Peter554:add-clippy (c12e5f1) with master (50d04f4)

Summary

✅ 17 untouched benchmarks

@seddonym seddonym merged commit 830ce44 into python-grimp:master Feb 8, 2025
18 checks passed
@Peter554 Peter554 deleted the add-clippy branch February 8, 2025 20:22
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