-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow Self::cmp(self, other)
as a correct impl
#11188
Conversation
This got into beta (https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=a2f01f29c980dc6da61c1ef714cc9709), so perhaps it should be backported? @rustbot label +beta-nominated |
@@ -161,3 +161,4 @@ pub const OPTION_UNWRAP: [&str; 4] = ["core", "option", "Option", "unwrap"]; | |||
pub const OPTION_EXPECT: [&str; 4] = ["core", "option", "Option", "expect"]; | |||
pub const FORMATTER: [&str; 3] = ["core", "fmt", "Formatter"]; | |||
pub const DEBUG_STRUCT: [&str; 4] = ["core", "fmt", "builders", "DebugStruct"]; | |||
pub const ORD_CMP: [&str; 4] = ["core", "cmp", "Ord", "cmp"]; |
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.
Wouldn't sym::cmp
work?
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.
No, take a look at this code for example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=bb80a74abe4315e2379584abce972f3b
If it both defines a method cmp
and also implements Ord
, and Ord
is not in scope (due to #![no_implicit_prelude]
), it'll call the method instead - not Ord::cmp
. Yet it still doesn't lint
But the suggestion is wrong and should be fixed...
f61b46a
to
91d1767
Compare
Hey @blyxyas can I give you this review? (I'm visiting my hometown for the next 3 weeks. It's totally fine if not, I should have enough time :)) |
IDK, if having you do my work so that I can have more free time is a skill issue 😉 /s I appreciate it! This way I'll have some time to work on Marker :D |
I mean, phrasing it like that sounds like I'm a loser /s |
Meaning it was a good come back, after you destroyed me ^^ |
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, just going to wait until CI is cleared to merge ^^
@bors r+ |
Allow `Self::cmp(self, other)` as a correct impl Fixes #11178 Also no longer checks if the method name is *just* cmp, but the path. That was an oversight on my part ^^ r? `@xFrednet` (and `@blyxyas` too!) changelog: [`incorrect_partial_ord_impl_on_ord_type`]: Now allows non-method calls to `cmp` like `Self::cmp(self, other)`
@bors r- |
@xFrednet you said to give this a review, but not about merging. Do you want to do a second-check or do I just merge? |
☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
I meant that you take over the full review ^^. But I'm happy to delegate your orders or bors: Dear lord bors, I'm pleased to announce that we have two new members in our powerful alliance. After their training, we have full trust in their magic powers. You already got the letter pigeon, informing you that they received r+ rights on this magnificent repository. I'm happy to pass along the r+ from princess @blyxyas (who is apparently more skilled in time management than me). During the quest to review #11188, she has slain multiple bugs. Her support @Centri3 artfully crafted multiple commits, therefore fortifying our stronghold against the gobbling. Please honer their contributions, by merging their changes into the great history book called MASTER You know, I'm always not sure if these commend are funny or come off as totally deranged. 😅 Just for the protocol, the intention is to be funny, humor can be weird ¯\_(ツ)_/¯ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
No backport necessary: This lint isn't in beta yet and this fix is already synced. |
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188 Closes WEB-1732
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188 Closes WEB-1732
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188 Closes WEB-1732
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188 Closes WEB-1732
This: - Updates rust-toolchain to nightly-2023-10-06 - Removes allowing clippy rules for needless_pass_by_ref_mut and non_canonical_partial_ord_impl as the linked issues appear to have been resolved in [0] and [1] respectively - Fixes apparently legitimate issues now reported by clippy Test Plan: CI [0] rust-lang/rust-clippy#11492 [1] rust-lang/rust-clippy#11188 Closes WEB-1732
Fixes #11178
Also no longer checks if the method name is just cmp, but the path. That was an oversight on my part ^^
r? @xFrednet
(and @blyxyas too!)
changelog: [
incorrect_partial_ord_impl_on_ord_type
]: Now allows non-method calls tocmp
likeSelf::cmp(self, other)