mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
4f4dae055b
Don't panic in ceil_char_boundary Implementing the alternative mentioned in this comment: https://github.com/rust-lang/rust/issues/93743#issuecomment-1579935853 Since `floor_char_boundary` will always work (rounding down to the length of the string is possible), it feels best for `ceil_char_boundary` to not panic either. However, the semantics of "rounding up" past the length of the string aren't very great, which is why the method originally panicked in these cases. Taking into account how people are using this method, it feels best to simply return the end of the string in these cases, so that the result is still a valid char boundary. |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
Cargo.toml |