about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-05 21:46:33 +0800
committerGitHub <noreply@github.com>2025-03-05 21:46:33 +0800
commit1b9b515674c46c8a59371b55ef857cbac8b985ae (patch)
tree15018bf1ff94ae69693b364dd1a523ff8dfce6a0 /compiler/rustc_error_codes
parent65da1ffe41c15b18736d12dcd1eb11343a0e3864 (diff)
parent0ca1c9c1dd184da0786e76d674e8f0c7f64ef124 (diff)
downloadrust-1b9b515674c46c8a59371b55ef857cbac8b985ae.tar.gz
rust-1b9b515674c46c8a59371b55ef857cbac8b985ae.zip
Rollup merge of #136662 - thaliaarchi:formatter-pad-char-count, r=m-ou-se
Count char width at most once in `Formatter::pad`

When both width and precision flags are specified, then `Formatter::pad` counts the character width twice. Instead, record the character width when truncating it to the precision, so it does not need to be recomputed. Simplify control flow so the cases are more clear.

Related:
- 6c9e708f4be (`fmt::Formatter::pad`: don't call chars().count() more than one time, 2021-09-01): Reduce counting chars from thrice to twice in worst case
- ede39aeb331 (feat: reinterpret `precision` field for strings, 2016-06-29): Change meaning of precision for strings
- b820748ff5a (Implement formatting arguments for strings and integers, 2013-08-10): Implement `Formatter::pad`
Diffstat (limited to 'compiler/rustc_error_codes')
0 files changed, 0 insertions, 0 deletions