Files
rust/src/libcore
bors 62690b3c3f Auto merge of #34544 - 3Hren:issue/xx/reinterpret-format-precision-for-strings, r=alexcrichton
feat: reinterpret `precision` field for strings

This commit changes the behavior of formatting string arguments with both width and precision fields set.

Documentation says that the `width` field is the "minimum width" that the format should take up. If the value's string does not fill up this many characters, then the padding specified by fill/alignment will be used to take up the required space.

This is true for all formatted types except string, which is truncated down to `precision` number of chars and then all of `fill`, `align` and `width` fields are completely ignored.

For example: `format!("{:/^10.8}", "1234567890);` emits "12345678". In the contrast Python version works as the expected:
```python
>>> '{:/^10.8}'.format('1234567890')
'/12345678/'
```

This commit gives back the `Python` behavior by changing the `precision` field meaning to the truncation and nothing more. The result string *will* be prepended/appended up to the `width` field with the proper `fill` char.

__However, this is the breaking change, I admit.__ Feel free to close it, but otherwise it should be mentioned in the `std::fmt` documentation somewhere near of `fill/align/width` fields description.
2016-07-21 16:19:54 -07:00
..
2016-07-15 17:51:27 +02:00
2016-06-02 19:36:10 +02:00
2016-07-10 19:41:50 +02:00
2016-03-01 20:44:48 +08:00
2016-06-04 15:10:26 -07:00
2016-07-13 17:40:16 -08:00
2016-05-07 08:52:41 -07:00
2016-07-15 15:41:31 -04:00
2016-05-23 10:03:44 -04:00
2015-12-21 09:26:21 -08:00
2016-07-08 13:35:17 +03:00
2016-07-20 15:54:54 -07:00
2016-06-29 01:13:03 +02:00
2016-02-09 16:00:50 -05:00