-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix: Add a deref in the test code #1192
Conversation
It's virtually impossible to write a the `num_sq` function to take the Box since it doesn't implement `MulAssign`.
I believe this PR is also a good moment to add something in the hints regard the |
Can this PR be merged? It only changes 1 line and saves people finishing Rustlings a good bunch of minutes up to an hour. |
@all-contributors please add @aaarkid for content |
@diannasoreil I've put up a pull request to add @aaarkid! 🎉 |
I'm surprised at this PR as now I can't implement the function without changing the test code. This was my implementationfn num_sq<T: AsMut<u32>>(mut arg: T) {
let arg = arg.as_mut();
*arg *= *arg;
} I have to remove the @aaarkid can you share your solution? |
Sure, in a bit. |
I also can't get it to compile in the "obvious" way, and it certainly works without the Another argument in favor of reverting this - the example right in the
It doesn't need to, isn't that the point of |
I see the issue. You're right the deref shouldn't be there. I'll open a new PR tomorrow to revert this. I apologize for the trouble this may have caused. In the meanwhile, do you think that the |
I'm not the target audience of Rustlings, but my gut says "no, it should not be there". |
Revert the addition of a deref in PR rust-lang#1192 by me, which should not be there. Apologies for the inconvenience caused.
My CI fails because of this change https://github.com/azzamsa/rustlings/actions/runs/3317605384/jobs/5480649114#step:6:12 |
Revert the addition of a deref in PR rust-lang#1192 by me, which should not be there. Apologies for the inconvenience caused.
Revert the addition of a deref in PR rust-lang#1192 by me, which should not be there. Apologies for the inconvenience caused.
This change makes it possible to finish the last exercise without touching the test code, seems like an overlook when code was added since there's nothing in the hints about this extension neither.
It's virtually impossible to write a the
num_sq
function to take the Box since it doesn't implementMulAssign
.