-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Less verbose output for unused arguments #43323
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This looks good to me, but I'm going to r? @GuillaumeGomez for final review. It looks like we already have the follow up issue which will make this even better: #41850. |
Woot! Thanks! |
Hmm... I'm wondering if it would be better to use something other than How would you have just the red "primary" error under the unused arguments, or just the blue "secondary" error lines under the unused arguments? EDIT: Seems like the red line is from |
cx.ecx.struct_span_err(errs.iter().map(|(sp, _)| *sp).collect::<Vec<Span>>(),
"multiple unused formatting arguments") which would give you the following output instead:
If you keep the
I personally think it looks slightly better without the labels in that case, but I'm not too fussed either way. |
I’ll wait to find out what @Mark-Simulacrum and @GuillaumeGomez prefer. @estebank where’s the best place to find documentation about this sort of thing? Also, thanks a lot for helping me! I really appreciate it! |
@perryprog my best advice would be to read the code. @Manishearth compiles the rustdoc for the compiler if you need a link for somebody else, but I always end up going back to the code itself as there're sometimes comments explaining what's going on. It's a great help to just see how other errors do their thing. I sometimes add a dependency on backtrace-rs to add a |
The code looks good and the current output seems fine to me (the "unused" is important). |
@GuillaumeGomez just want to make sure I'm clear here: Are you good with this output:
or are you good with what I have in the PR currently: @estebank that sounds good, I'm just having a bit of trouble getting the code you gave me to work. I changed it a bit to be this: let mut diag = cx.ecx.struct_span_err(
errs.iter().map(|&(sp, _)| sp).collect::<Vec<Span>>(),
"multiple unused formatting arguments"
); However, it seems like the
|
I'm good with what you have currently. :) |
@GuillaumeGomez oh, ok 😛. Once #41850 is closed, we should improve the output thought. I think I’ll write some more tests, and then this’ll be ready for a merge. |
@perryprog I thought that Having said that, given @GuillaumeGomez comment, you don't need to do that for this PR. |
@bors r+ |
📌 Commit 0fcb4fc has been approved by |
I'll add the tests in a separate PR, is that fine? |
@bors r- @perryprog missed the bit about adding more tests, let's add them to this PR so they're self contained (easier to track down the work done after the fact that way). Ping me when you've added them and I'll r+ again. |
I'm just adding some UI tests — should I just add them all inside this file? |
Only if they're tightly related to that test, otherwise just create a new file with a descriptive title. |
@estebank ping pong 🏓 |
@bors r+ |
📌 Commit 5c10db3 has been approved by |
Less verbose output for unused arguments Closes #37718 This is my first contribution to rust, so sorry if I'm missing anything! The output now looks like this: <img width="831" alt="screen shot 2017-07-18 at 5 01 32 pm" src="https://user-images.githubusercontent.com/12972285/28347566-dbfa9962-6c05-11e7-8730-c2e8062a04cc.png"> It's not the prettiest, but whenever #41850 gets resolved, this should be able to be improved. **EDIT:** This also does not seem r? @Mark-Simulacrum
☀️ Test successful - status-appveyor, status-travis |
Closes #37718
This is my first contribution to rust, so sorry if I'm missing anything!
The output now looks like this:
It's not the prettiest, but whenever #41850 gets resolved, this should be able to be improved.
EDIT: This also does not seem
r? @Mark-Simulacrum