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
Ignore fix for from_over_into
if the target type contains a Self
reference
#10853
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon. 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 (
|
Tricky one for a first contribution 😄 We might be able to do it without re-lexing by getting the spans of all the Maybe we should just stick if !target_ty.find_self_aliases().is_empty() {
return None;
} in |
Sounds reasonable, now the change doesn't look like a 3AM, 5th-attempt, third-redbull leetcode submission. Hopefully this was correct, I did the exit as early as possible, the stderr file is unchanged since the lint is just ignored, and the .fixed file keeps the original code, I think that's how it's supposed to look |
Self
referencefrom_over_into
if the target type contains a Self
reference
Thanks @MarcusGrass! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #10838.
This is my first time contributing here, and the fix is kind of ugly.
I've worked a bit with
quote
and was trying to figure out a way to replace the type in a better way than just a raw string-replace but couldn't quite figure out how to.The only thing really required to fix this, is to replace all
Self
references with the type stated in thefrom
variable, this isn't entirely simple to do with raw strings without creating a mess though.We need to find and replace all
Self
's in a variable withfrom
but there could be an arbitrary amount, in a lot of different positions. As well as some type that contains the name self, likeSelfVarSelf
which shouldn't be replaced.The strategy is essentially, if
"Self"
is surrounded on both sides by something that isn't alphanumeric, then we're golden, then trying to make that reasonably efficient.I would not be offended if the solution is too messy to accept!
changelog: [from_over_into]: Replace Self with the indicated variable in suggestion and fix.