File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -271,14 +271,13 @@ impl str {
271271
272272 /// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`.
273273 ///
274+ /// If `x` is greater than the length of the string, this returns the length of the string.
275+ ///
274276 /// This method is the natural complement to [`floor_char_boundary`]. See that method
275277 /// for more details.
276278 ///
277279 /// [`floor_char_boundary`]: str::floor_char_boundary
278280 ///
279- /// # Panics
280- ///
281- /// Panics if `index > self.len()`.
282281 ///
283282 /// # Examples
284283 ///
@@ -296,7 +295,7 @@ impl str {
296295 #[ inline]
297296 pub fn ceil_char_boundary ( & self , index : usize ) -> usize {
298297 if index > self . len ( ) {
299- slice_error_fail ( self , index , index )
298+ self . len ( )
300299 } else {
301300 let upper_bound = Ord :: min ( index + 4 , self . len ( ) ) ;
302301 self . as_bytes ( ) [ index..upper_bound]
You can’t perform that action at this time.
0 commit comments