This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 5e368e2
authored
Unrolled build for rust-lang#130819
Rollup merge of rust-lang#130819 - bjoernager:char-must-use-len-utf, r=Noratrieb
Add `must_use` attribute to `len_utf8` and `len_utf16`.
The `len_utf8` and `len_utf16` methods in `char` should have the `must_use` attribute.
The somewhat similar method `<[T]>::len` has had this attribute since rust-lang#95274. Considering that these two methods would most likely be used to test the size of a buffer (before a call to `encode_utf8` or `encode_utf16`), *not* using their return values could indicate a bug.
According to ["When to add `#[must_use]`](https://std-dev-guide.rust-lang.org/policy/must-use.html), this is **not** considered a breaking change (and could be reverted again at a later time).1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
609 | 610 | | |
610 | 611 | | |
611 | 612 | | |
| |||
637 | 638 | | |
638 | 639 | | |
639 | 640 | | |
| 641 | + | |
640 | 642 | | |
641 | 643 | | |
642 | 644 | | |
| |||
1738 | 1740 | | |
1739 | 1741 | | |
1740 | 1742 | | |
| 1743 | + | |
1741 | 1744 | | |
1742 | 1745 | | |
1743 | 1746 | | |
| |||
1748 | 1751 | | |
1749 | 1752 | | |
1750 | 1753 | | |
| 1754 | + | |
1751 | 1755 | | |
1752 | 1756 | | |
1753 | 1757 | | |
| |||
0 commit comments