-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-panicArea: Panicking machineryArea: Panicking machineryC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
When writing non-panicking code, it is impossible to use the "{:X}"
format specifier as the impl core::fmt::UpperHex for usize
and similar code might panic. It seems that it is because the GenericRadix::fmt_int method is using slice indexing notation here:
let buf = &buf[curr..];
This seem to be easily avoidable by replacing it with buf.get(curr..)
and some error handling.
ericlagergren
Metadata
Metadata
Assignees
Labels
A-panicArea: Panicking machineryArea: Panicking machineryC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.