This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit d80f127
committed
Avoid panic_bounds_check in fmt::write.
Writing any fmt::Arguments would trigger the inclusion of usize
formatting and padding code in the resulting binary, because indexing
used in fmt::write would generate code using panic_bounds_check, which
prints the index and length.
These bounds checks are not necessary, as fmt::Arguments never contains
any out-of-bounds indexes.
This change replaces them with unsafe get_unchecked, to reduce the
amount of generated code, which is especially important for embedded
targets.1 parent ad268bd commit d80f127
1 file changed
+20
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
1085 | | - | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1086 | 1088 | | |
1087 | 1089 | | |
1088 | 1090 | | |
| |||
1096 | 1098 | | |
1097 | 1099 | | |
1098 | 1100 | | |
1099 | | - | |
| 1101 | + | |
1100 | 1102 | | |
1101 | 1103 | | |
1102 | 1104 | | |
1103 | | - | |
1104 | | - | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1105 | 1111 | | |
1106 | 1112 | | |
1107 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
1108 | 1117 | | |
1109 | 1118 | | |
1110 | 1119 | | |
1111 | 1120 | | |
1112 | 1121 | | |
1113 | | - | |
| 1122 | + | |
1114 | 1123 | | |
1115 | 1124 | | |
1116 | 1125 | | |
1117 | | - | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1118 | 1131 | | |
1119 | 1132 | | |
1120 | 1133 | | |
| |||
0 commit comments