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

Enable lints #191

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Enable lints #191

wants to merge 4 commits into from

Conversation

bircni
Copy link

@bircni bircni commented Jan 11, 2025

No description provided.

Copy link
Collaborator

@spenserblack spenserblack left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I'll review this in more detail later, but here's some things that stood out to me immediately.

.github/workflows/test.yml Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
@bircni bircni requested a review from spenserblack January 12, 2025 00:54
@bircni
Copy link
Author

bircni commented Jan 12, 2025

already did some fixes

Copy link
Collaborator

@spenserblack spenserblack left a comment

Choose a reason for hiding this comment

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

Thanks for the quick response! After reviewing, most of the changes are reasonable. I think the #[must_use] is especially helpful for users who might mistakenly do this:

let mut s = "hello, world";
s.green(); // must_use raise for this
println!("{s}");

My main concern is with the change to const fn. What do you think?


A small bit of feedback on making formatting PRs: IMO, it's better to have one commit that sets the rules, and a second commit to actually apply them, instead of both setting rules and formatting in one commit. This allows:

  • the reviewer to see what errors would get raised before formatting is applied, by checkout out the pre-format commit.
  • one to create a .git-blame-ignore-revs entry to ignore formatting changes without ignoring rule changes.

It's easier to squash multiple commits into one than to un-squash one commit into multiple.

But this is just a small nitpick, and a personal preference mostly, so don't worry about it for this PR 🙂

src/color.rs Outdated Show resolved Hide resolved
@@ -168,7 +169,7 @@ mod specs {
fn clicolor_behavior() {
rspec::run(&rspec::describe("ShouldColorize", (), |ctx| {
ctx.specify("::normalize_env", |ctx| {
ctx.it("should return None if error", |_| {
ctx.it("should return None if error", |()| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using |_| is the documented usage for rspec, per their README. What was the linting rule (and its reason) for switching from _?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, makes sense. In summary, if rspec changes their usage and starts passing a value instead of (), we'll know about it through a compilation error. Works for me!

Copy link
Author

Choose a reason for hiding this comment

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

exactly!

@spenserblack
Copy link
Collaborator

Thanks for the work! I'll leave this PR open for a week or two to give any of the other maintainers a chance to chime in if they choose. Feel free to ping me if you feel like I'm leaving this PR open too long 🙂

@spenserblack spenserblack self-assigned this Jan 13, 2025
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