Skip to content

feat: Add clippy lints #269

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

Merged
merged 1 commit into from
Feb 26, 2020
Merged

feat: Add clippy lints #269

merged 1 commit into from
Feb 26, 2020

Conversation

Tarnadas
Copy link
Contributor

This is a feature PR which adds the possiblity to create clippy exercises.

Clippy has many awesome linting rules, which can give a deeper understanding about the Rust programming language, therefor I made this PR.

@manyinsects manyinsects self-requested a review February 15, 2020 10:29
Copy link
Member

@manyinsects manyinsects left a comment

Choose a reason for hiding this comment

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

This is a good idea! I think that we should have a bit more information about how to run these kinds of exercises, probably in the comments of clippy1.rs. Something explaining what exactly Clippy is would help too.

fs::write(CLIPPY_CARGO_TOML_PATH, cargo_toml)
.expect("Failed to write 📎 Clippy 📎 Cargo.toml file.");
Command::new("cargo")
.args(&["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
Copy link
Member

Choose a reason for hiding this comment

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

This would imply that you have to have Clippy installed, right? As far as I know, Clippy isn't added as a default Rustup component, so you'd have to mention somewhere that you need to explicitly do rustup component add clippy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right.
I added the Clippy installation to the install scripts. I assume this should be good then?

@@ -2,3 +2,5 @@
target/
**/*.rs.bk
.DS_Store
exercises/clippy/Cargo.toml
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming the separate Cargo.toml is so that Clippy doesn't lint the entire project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was hoping that there is an option to invoke Clippy without Cargo and without a Cargo.toml and just pass it the bin with an option, but it seems that this is not possible.
This is why I'm generating a custom Cargo.toml just to invoke Clippy with it

@Tarnadas Tarnadas force-pushed the master branch 2 times, most recently from acc4e28 to 25de8fd Compare February 21, 2020 14:53
@Tarnadas
Copy link
Contributor Author

This is a good idea! I think that we should have a bit more information about how to run these kinds of exercises, probably in the comments of clippy1.rs. Something explaining what exactly Clippy is would help too.

I added a section to the first Clippy example. I'm not sure if this is enough or if a README should be added.

@manyinsects
Copy link
Member

I'm not sure if this is enough or if a README should be added.

I would say just to be sure, add a README file that explains that you need Clippy installed for these exercises (but that, if you'd used the installation script, it would have already installed it for you). Also, a link to more information about Clippy would be good to have in that file.

Other than that, looks good to me!

@bors
Copy link
Contributor

bors commented Feb 26, 2020

☔ The latest upstream changes (presumably #277) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: Waiting on issue/PR author label Feb 26, 2020
- adds a new 'clippy' category for exercises
- clippy exercises should throw no warnings
- install script now also installs clippy

is related to rust-lang/rust-clippy#2604
@Tarnadas
Copy link
Contributor Author

I fixed the conflicts and added a README

@manyinsects
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 26, 2020

📌 Commit 1e2fd9c has been approved by fmoko

@bors bors added S-waiting-on-bors and removed S-waiting-on-author Status: Waiting on issue/PR author labels Feb 26, 2020
@bors
Copy link
Contributor

bors commented Feb 26, 2020

⌛ Testing commit 1e2fd9c with merge a03d965...

@bors
Copy link
Contributor

bors commented Feb 26, 2020

☀️ Test successful - checks-travis
Approved by: fmoko
Pushing a03d965 to master...

@bors bors merged commit a03d965 into rust-lang:master Feb 26, 2020
@liby
Copy link
Contributor

liby commented Sep 4, 2021

@Tarnadas
Sorry to interrupt. I have a question about this PR. I want to modify this line of code, in order to achieve the purpose of modifying the Cargo.toml file generated under the exercises/clippy folder.
But I found that no matter how I modify it, I will not change the contents of the exercises/clippy/Cargo.toml file. May I ask why? If there is an obvious answer to the question I ask, I'm sorry I can't see it.

ppp3 pushed a commit to ppp3/rustlings that referenced this pull request May 23, 2022
feat: Add clippy lints

This is a feature PR which adds the possiblity to create clippy exercises.

Clippy has many awesome linting rules, which can give a deeper understanding about the Rust programming language, therefor I made this PR.
dmoore04 pushed a commit to dmoore04/rustlings that referenced this pull request Sep 11, 2022
feat: Add clippy lints

This is a feature PR which adds the possiblity to create clippy exercises.

Clippy has many awesome linting rules, which can give a deeper understanding about the Rust programming language, therefor I made this PR.
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.

5 participants