-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Missed opportunity for the "consider borrowing" hint #103725
Comments
Is it supposed to suggest cloning over borrowing for even simple non-mut stuff? let mut tmp = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let paths = fs::read_dir(tmp).unwrap();
tmp.pop();
That message is kind of weird, "consider cloning the value if the performance cost is acceptable". I can imagine some contexts where it's useful, like returning owned values made from references. But this is a pretty trivial case when passing |
Current output:
@tgross35 yes, borrowing would be a better suggestion here. That case is covered by #41708. |
Current output:
I do not think that addressing the minimal solution to #41708 (which would be to explicitly look for an |
Given the following code:
(playground link)
... the current output is:
Ideally, this should also display the
consider mutably borrowing 'not_copy': &mut *not_copy
hint, since that's the solution to problem 🙂The text was updated successfully, but these errors were encountered: