Skip to content
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

Added clippy to CI and fixed all clippy warnings #613

Merged
merged 20 commits into from
Oct 10, 2023

Conversation

mdashti
Copy link
Contributor

@mdashti mdashti commented Oct 6, 2023

It's a good practice to follow the Rust idioms, and using clippy and make sure to have no unintentional clippy warning is a healthy check for pgcat. This PR adds clippy to CI and also fixes all the existing clippy warnings.

@mdashti mdashti marked this pull request as draft October 6, 2023 22:50
@mdashti mdashti marked this pull request as ready for review October 10, 2023 09:28
@mdashti
Copy link
Contributor Author

mdashti commented Oct 10, 2023

@levkk This PR is ready for review. I had to go through several hoops to figure out one change (suggested by clippy) was causing errors (such as this build: https://app.circleci.com/pipelines/github/postgresml/pgcat/2049/workflows/97dfd55a-ed49-4076-a909-6513741686e9/jobs/2070). I did not squash the changes, to make the steps visible.

@@ -777,8 +770,8 @@ impl<'de> serde::Deserialize<'de> for DefaultShard {
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
if s.starts_with("shard_") {
let shard = s[6..].parse::<usize>().map_err(serde::de::Error::custom)?;
if let Some(s) = s.strip_prefix("shard_") {
Copy link
Contributor

@levkk levkk Oct 10, 2023

Choose a reason for hiding this comment

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

Way better. I wonder how clippy figured this out, pretty impressive.

Copy link
Contributor

@levkk levkk left a comment

Choose a reason for hiding this comment

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

Sweet!

@levkk levkk merged commit de8df29 into postgresml:main Oct 10, 2023
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