forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#91568 - dtolnay:breakspace, r=nagisa
Pretty print break and continue without redundant space **Repro:** ```rust macro_rules! m { ($e:expr) => { stringify!($e) }; } fn main() { println!("{:?}", m!(loop { break; })); println!("{:?}", m!(loop { break 'a; })); println!("{:?}", m!(loop { break false; })); } ``` **Before:** - `"loop { break ; }"` - `"loop { break 'a ; }"` - `"loop { break false ; }"` **After:** - `"loop { break; }"` - `"loop { break 'a; }"` - `"loop { break false; }"` <br> Notice that `return` and `yield` already follow the same approach as this PR of printing the space *before* each additional piece following the keyword, rather than *after* each thing. https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_ast_pretty/src/pprust/state.rs#L2148-L2154 https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_ast_pretty/src/pprust/state.rs#L2221-L2228
- Loading branch information
Showing
5 changed files
with
11 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters