File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,11 @@ impl OsString {
557557    pub ( crate )  fn  as_mut_vec_for_path_buf ( & mut  self )  -> & mut  Vec < u8 >  { 
558558        self . inner . as_mut_vec_for_path_buf ( ) 
559559    } 
560+ 
561+     #[ inline]  
562+     pub ( crate )  fn  truncate ( & mut  self ,  len :  usize )  { 
563+         self . inner . truncate ( len) ; 
564+     } 
560565} 
561566
562567#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
Original file line number Diff line number Diff line change @@ -1305,7 +1305,7 @@ impl PathBuf {
13051305
13061306        // absolute `path` replaces `self` 
13071307        if  path. is_absolute ( )  || path. prefix ( ) . is_some ( )  { 
1308-             self . as_mut_vec ( ) . truncate ( 0 ) ; 
1308+             self . inner . truncate ( 0 ) ; 
13091309
13101310        // verbatim paths need . and .. removed 
13111311        }  else  if  comps. prefix_verbatim ( )  && !path. inner . is_empty ( )  { 
@@ -1350,7 +1350,7 @@ impl PathBuf {
13501350        // `path` has a root but no prefix, e.g., `\windows` (Windows only) 
13511351        }  else  if  path. has_root ( )  { 
13521352            let  prefix_len = self . components ( ) . prefix_remaining ( ) ; 
1353-             self . as_mut_vec ( ) . truncate ( prefix_len) ; 
1353+             self . inner . truncate ( prefix_len) ; 
13541354
13551355        // `path` is a pure relative path 
13561356        }  else  if  need_sep { 
@@ -1383,7 +1383,7 @@ impl PathBuf {
13831383    pub  fn  pop ( & mut  self )  -> bool  { 
13841384        match  self . parent ( ) . map ( |p| p. as_u8_slice ( ) . len ( ) )  { 
13851385            Some ( len)  => { 
1386-                 self . as_mut_vec ( ) . truncate ( len) ; 
1386+                 self . inner . truncate ( len) ; 
13871387                true 
13881388            } 
13891389            None  => false , 
Original file line number Diff line number Diff line change @@ -207,6 +207,11 @@ impl Buf {
207207    pub ( crate )  fn  as_mut_vec_for_path_buf ( & mut  self )  -> & mut  Vec < u8 >  { 
208208        & mut  self . inner 
209209    } 
210+ 
211+     #[ inline]  
212+     pub ( crate )  fn  truncate ( & mut  self ,  len :  usize )  { 
213+         self . inner . truncate ( len) ; 
214+     } 
210215} 
211216
212217impl  Slice  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments