File tree 3 files changed +25
-15
lines changed
3 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -553,10 +553,10 @@ impl OsString {
553
553
}
554
554
555
555
/// Part of a hack to make PathBuf::push/pop more efficient.
556
- #[ inline]
557
- pub ( crate ) fn as_mut_vec_for_path_buf ( & mut self ) -> & mut Vec < u8 > {
558
- self . inner . as_mut_vec_for_path_buf ( )
559
- }
556
+ // #[inline]
557
+ // pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
558
+ // self.inner.as_mut_vec_for_path_buf()
559
+ // }
560
560
561
561
/// More well behaving alternative to allowing outer types
562
562
/// full mutable access to the core `Vec`.
@@ -565,6 +565,11 @@ impl OsString {
565
565
pub ( crate ) fn truncate ( & mut self , len : usize ) {
566
566
self . inner . truncate ( len) ;
567
567
}
568
+
569
+ #[ inline]
570
+ pub ( crate ) fn extend_from_slice ( & mut self , other : & [ u8 ] ) {
571
+ self . inner . extend_from_slice ( other) ;
572
+ }
568
573
}
569
574
570
575
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
Original file line number Diff line number Diff line change @@ -1163,10 +1163,10 @@ pub struct PathBuf {
1163
1163
}
1164
1164
1165
1165
impl PathBuf {
1166
- #[ inline]
1167
- fn as_mut_vec ( & mut self ) -> & mut Vec < u8 > {
1168
- self . inner . as_mut_vec_for_path_buf ( )
1169
- }
1166
+ // #[inline]
1167
+ // fn as_mut_vec(&mut self) -> &mut Vec<u8> {
1168
+ // self.inner.as_mut_vec_for_path_buf()
1169
+ // }
1170
1170
1171
1171
/// Allocates an empty `PathBuf`.
1172
1172
///
@@ -2645,18 +2645,18 @@ impl Path {
2645
2645
None => {
2646
2646
// Enough capacity for the extension and the dot
2647
2647
let capacity = self_len + extension. len ( ) + 1 ;
2648
- let whole_path = self_bytes. iter ( ) ;
2648
+ let whole_path = self_bytes;
2649
2649
( capacity, whole_path)
2650
2650
}
2651
2651
Some ( previous_extension) => {
2652
2652
let capacity = self_len + extension. len ( ) - previous_extension. len ( ) ;
2653
- let path_till_dot = self_bytes[ ..self_len - previous_extension. len ( ) ] . iter ( ) ;
2653
+ let path_till_dot = & self_bytes[ ..self_len - previous_extension. len ( ) ] ;
2654
2654
( capacity, path_till_dot)
2655
2655
}
2656
2656
} ;
2657
2657
2658
2658
let mut new_path = PathBuf :: with_capacity ( new_capacity) ;
2659
- new_path. as_mut_vec ( ) . extend ( slice_to_copy) ;
2659
+ new_path. inner . extend_from_slice ( slice_to_copy) ;
2660
2660
new_path. set_extension ( extension) ;
2661
2661
new_path
2662
2662
}
Original file line number Diff line number Diff line change @@ -203,10 +203,10 @@ impl Buf {
203
203
}
204
204
205
205
/// Part of a hack to make PathBuf::push/pop more efficient.
206
- #[ inline]
207
- pub ( crate ) fn as_mut_vec_for_path_buf ( & mut self ) -> & mut Vec < u8 > {
208
- & mut self . inner
209
- }
206
+ // #[inline]
207
+ // pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
208
+ // &mut self.inner
209
+ // }
210
210
211
211
/// More well behaving alternative to allowing outer types
212
212
/// full mutable access to the core `Vec`.
@@ -215,6 +215,11 @@ impl Buf {
215
215
pub ( crate ) fn truncate ( & mut self , len : usize ) {
216
216
self . inner . truncate ( len) ;
217
217
}
218
+
219
+ #[ inline]
220
+ pub ( crate ) fn extend_from_slice ( & mut self , other : & [ u8 ] ) {
221
+ self . inner . extend_from_slice ( other) ;
222
+ }
218
223
}
219
224
220
225
impl Slice {
You can’t perform that action at this time.
0 commit comments