-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Introduce a cargo clippy
run
#2025
base: main
Are you sure you want to change the base?
Conversation
0590609
to
3917067
Compare
Personally, I don’t always agree with Clippy, but it a very widely recommended tool for writing idiomatic Rust. So on balance, I think it’s overall a good idea to enable it for both our exercises and our tooling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This will help make style more consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was worried that this might "correct" some things that had been written as-is for didactic reasons, but it looks like those are handled well. It also seems that this isn't scanning code in rust
blocks in the .md
files, which probably helps.
blood_pressure_change: match self.last_blood_pressure { | ||
Some(lbp) => { | ||
Some((bp.0 as i32 - lbp.0 as i32, bp.1 as i32 - lbp.1 as i32)) | ||
} | ||
None => None, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably exclude third_party/ somehow..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good idea! Let me figure out how to do that before merging!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the settings are done in the workspace Cargo.toml and every Cargo.toml has a workspace = true
in the [lints]
section as described in https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table we could tell cargo clippy what to do in the third_party Cargo.toml.
This would enable a central configuration for clippy and gives the option to override specific settings for individual components
Another thought, as discussed on #2410. We should try and enable Clippy as part of |
This might help catch stylistic problems in our Rust code.