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
Correctly suggest std or core path depending if this is a no_std
crate
#12149
Conversation
2c95d8d
to
e489348
Compare
e489348
to
40a45a4
Compare
@@ -204,7 +204,7 @@ pub(super) fn check<'tcx>( | |||
cx, | |||
UNNECESSARY_SORT_BY, | |||
expr.span, | |||
"use Vec::sort_by_key here instead", | |||
"consider using `sort_by_key`", |
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 method comes from slices so doesn't make much sense to only write Vec::
.
@@ -227,7 +227,7 @@ pub(super) fn check<'tcx>( | |||
cx, | |||
UNNECESSARY_SORT_BY, | |||
expr.span, | |||
"use Vec::sort here instead", | |||
"consider using `sort`", |
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.
Same here.
I wonder if a helper method that returns Otherwise the change looks good to me. |
I thought about it as well, but I'm not sure what's the best course of action here for the arguments. Few ideas I had:
A preference maybe? |
Since most usages will be used in formatting anyway, a function that returns either |
Let's go for |
Oh there is already |
Updated! |
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
1 similar comment
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
A few lints emit suggestions using
std
paths whether or not this is ano_std
crate, which is an issue when runningrustfix
afterwards. So in case this is an item that is defined in bothstd
andcore
, we need to check if the crate isno_std
to emit the right path.r? @llogiq
changelog: Correctly suggest std or core path depending if this is a
no_std
crate