-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New lint: redundant_test_prefix
#13710
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
New lint: redundant_test_prefix
#13710
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dswij (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@dswij any ETA on when you'll be able to review (it has been more than 2 weeks -- so, I am not sure whether there needs to be some action on my part to get this rolling). |
@J-ZhengLi @xFrednet sorry to bother you, but maybe you'll have time to review this PR (since you've provided good feedback on its previous incarnation -- and I've incorporated your suggestions). Really eager to receive my first feedback on this one (still learning the clippy's tooling), before diving into any other open tasks/issues. |
Hej, thank you for the ping. Sure, I'll add it to my reviewing list. You should get some feedback this weekend! @J-ZhengLi You're welcome to also help with the review if you want. But also don't feel any pressure :) r? @xFrednet |
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.
Very solid start. Thank you for picking up the other PR, it's nice to see it being worked on! :D
Please let me know if you have any questions.
tests/ui-toml/redundant_test_prefix/redundant_test_prefix.custom_suffix.fixed
Outdated
Show resolved
Hide resolved
I'm unassigning myself from this PR. @farazdagi if you want to continue this work, please request a new reviewer with |
This comment has been minimized.
This comment has been minimized.
eb06e26
to
c89ac83
Compare
77b4636
to
11811d6
Compare
Implemented suggestions from the review (thanks @xFrednet for great pointers) r? clippy |
@rustbot ready |
r? @samueltardieu for now |
10de1a6
to
cc70493
Compare
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.
This is neater indeed without the configuration option.
I have some remarks left, about the style, it won't change anything in the uitest output.
cc70493
to
3936d49
Compare
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.
Almost there! Those latest comments are stylish issues, and some cleanups that could be done while you're editing this part of the code.
The only "performance" issue (and change proposal) is that it is more costly to intern things than to get their textual representation back, so it is best to intern only once.
Thanks for your patience.
7fe7a1b
to
0efbe2b
Compare
No problem at all -- learning from this review process almost more than from the lint's implementation itself. So, thank you for such an insightful review. |
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.
Looks like you missed this one. The rest looks good to me!
0efbe2b
to
e2422a6
Compare
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.
LGTM
@rustbot label -S-waiting-on-author
Thanks @farazdagi. The new lint will likely appear in the nightly toolchain before the end of the week. |
This PR has started as an effort to proceed from the feedback in #12861.
#[test]
annotation) for redundant "test_" prefix.test_foo()
results in a name collision (either because functionfoo()
is already defined within the current scope, or because thefoo()
call exists within function -- thus creating an unwanted recursion), lint suggests function rename, warning the user that a simple trimming oftest_
prefix will result in a name collision.test_const
,test_
,test_42
), then again no auto-fix is suggested, user is asked to rename function, with a note that a simple prefix trimming will result in an invalid function name. (Applicability::HasPlaceholders
is used and user is suggested to: droptest_
prefix + add_works
suffix, i.e.test_foo
becomesfoo_works
-- but again, user has to apply those changes manually).fixes #8931
changelog: new lint: [
redundant_test_prefix
]