Skip to content

Commit

Permalink
Auto merge of #112387 - clarfonthey:non-panicking-ceil-char-boundary,…
Browse files Browse the repository at this point in the history
… r=m-ou-se

Don't panic in ceil_char_boundary

Implementing the alternative mentioned in this comment: rust-lang/rust#93743 (comment)

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.
  • Loading branch information
bors committed Aug 15, 2023
2 parents 4825513 + 9ec2b76 commit 53acce8
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 53acce8

Please sign in to comment.