-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc_deprecated suggestions don't always cargo fix correctly #84637
Comments
Yes, I think that would work - but it seems like a slightly less friendly error. If you suggested |
Oh, I guess that doesn't work if it's |
@rustbot claim I want to try it. |
This one is very interesting and I'm not really sure if it's still So, my first step was to modify
Next the
but it does not, instead it will "fix" it to:
So, I'm not entirely sure how to fix this.
This is the first point where I'm not sure if that is the correct way. Should |
hey @hi-rustin how are you doing on this? |
Yes, I would like to solve it. But I haven't had a chance to code it yet, so if you already have a solution you can just submit a PR. It's OK for me. |
If you want to submit a PR you can let me know and I can unassign myself. |
I haven't done anything yet but the initial post ;) So you can work on it as you like. |
I have found a solution to get only the span of the method that already works. I will submit the patch later. |
Rust version: stable 1.51.0
Given the following code that uses the
std::str::trim_left
function that is markedrustc_deprecated
:The current output is:
If I run
cargo fix
on this example, I get this output:The
suggestion
from therustc_deprecated
attribute applied correctly to the usage on line 4, but it replacedstr::trim_left
with justtrim_start
on line 2. I expected it to change this line tolet foo = str::trim_start(" aoeu");
.I'm not sure if the solution is to change the
^^^^^^
span marking to the leaf item that's deprecated. It seems like perhaps if the warning instead was:then perhaps only the
trim_left
instr::trim_left
would be replaced by rustfix? If so, I'd like to try my hand at fixing this. I've read somerustc_deprecated
related issues, however, and I'm getting a strong here-be-dragons vibe from them, so I wanted to check with someone more knowledgeable about if I'm on the right track before the yaks eat me.The text was updated successfully, but these errors were encountered: