File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -271,14 +271,13 @@ impl str {
271
271
272
272
/// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`.
273
273
///
274
+ /// If `x` is greater than the length of the string, this returns the length of the string.
275
+ ///
274
276
/// This method is the natural complement to [`floor_char_boundary`]. See that method
275
277
/// for more details.
276
278
///
277
279
/// [`floor_char_boundary`]: str::floor_char_boundary
278
280
///
279
- /// # Panics
280
- ///
281
- /// Panics if `index > self.len()`.
282
281
///
283
282
/// # Examples
284
283
///
@@ -296,7 +295,7 @@ impl str {
296
295
#[ inline]
297
296
pub fn ceil_char_boundary ( & self , index : usize ) -> usize {
298
297
if index > self . len ( ) {
299
- slice_error_fail ( self , index , index )
298
+ self . len ( )
300
299
} else {
301
300
let upper_bound = Ord :: min ( index + 4 , self . len ( ) ) ;
302
301
self . as_bytes ( ) [ index..upper_bound]
You can’t perform that action at this time.
0 commit comments