forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#40241 - Sawyer47:fix-39997, r=alexcrichton
Change how the `0` flag works in format! Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits. Here's a short summary of how similar format strings work in Python and Rust: ``` :05 :<05 :>05 :^05 Python 3.6 |-0001| |-1000| |000-1| |0-100| Rust before |-0001| |-1000| |-0001| |-0100| Rust after |-0001| |-0001| |-0001| |-0001| :#05x :<#05x :>#05x :^#05x Python 3.6 |0x001| |0x100| |000x1| |00x10| Rust before |0x001| |0x100| |000x1| |0x010| Rust after |0x001| |0x001| |0x001| |0x001| ``` Fixes rust-lang#39997 [breaking-change]
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
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