-
Notifications
You must be signed in to change notification settings - Fork 13k
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
add suggestion for wrongly ordered format parameters #134877
add suggestion for wrongly ordered format parameters #134877
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) some time within the next two weeks. 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 (
|
//~^ ERROR invalid format string: expected `}`, found `x` | ||
//~| HELP did you mean `x?`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it made sense to return the same error description, expected '}'...
, rather than introducing a new one, as it's the actual underlying error. I added a suggestion to reorder the format parameter if a #/x/X
character is spotted afterward. However, I completely understand if the preference is to add a new error message similar to the approach taken in the previous PR this one replaces.
e35719c
to
62c3c9a
Compare
@@ -197,6 +197,8 @@ builtin_macros_format_redundant_args = redundant {$n -> | |||
|
|||
builtin_macros_format_remove_raw_ident = remove the `r#` | |||
|
|||
builtin_macros_format_reorder_format_parameter = did you mean `{$replacement}`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, we prefer not to ask questions of the user anymore. If I were writing this message, I'd say something like "you might have meant to write #?
".
@bors r+ |
…p-message, r=estebank add suggestion for wrongly ordered format parameters Add suggestion for wrongly ordered format parameters like `?#`. Supersedes rust-lang#131004 Fix rust-lang#129966
Rollup of 7 pull requests Successful merges: - rust-lang#131439 (Remove allowing static_mut_refs lint) - rust-lang#133292 (E0277: suggest dereferencing function arguments in more cases) - rust-lang#134080 (Avoid use of LFS64 symbols on Emscripten) - rust-lang#134877 (add suggestion for wrongly ordered format parameters) - rust-lang#134926 (Update books) - rust-lang#134945 (Some small nits to the borrowck suggestions for mutating a map through index) - rust-lang#134979 (Provide structured suggestion for `impl Default` of type where all fields have defaults) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 6 pull requests Successful merges: - rust-lang#131439 (Remove allowing static_mut_refs lint) - rust-lang#133292 (E0277: suggest dereferencing function arguments in more cases) - rust-lang#134877 (add suggestion for wrongly ordered format parameters) - rust-lang#134945 (Some small nits to the borrowck suggestions for mutating a map through index) - rust-lang#134950 (bootstrap: Overhaul and simplify the `tool_check_step!` macro) - rust-lang#134979 (Provide structured suggestion for `impl Default` of type where all fields have defaults) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134877 - DavisRayM:129966-format-string-help-message, r=estebank add suggestion for wrongly ordered format parameters Add suggestion for wrongly ordered format parameters like `?#`. Supersedes rust-lang#131004 Fix rust-lang#129966
Add suggestion for wrongly ordered format parameters like
?#
.Supersedes #131004
Fix #129966