@@ -129,11 +129,7 @@ impl BytesContainer for Path {
129
129
self . into_vec ( )
130
130
}
131
131
#[ inline]
132
- fn container_as_str < ' a > ( & ' a self ) -> & ' a str {
133
- self . as_str ( ) . unwrap ( )
134
- }
135
- #[ inline]
136
- fn container_as_str_opt < ' a > ( & ' a self ) -> Option < & ' a str > {
132
+ fn container_as_str < ' a > ( & ' a self ) -> Option < & ' a str > {
137
133
self . as_str ( )
138
134
}
139
135
#[ inline]
@@ -146,11 +142,7 @@ impl<'a> BytesContainer for &'a Path {
146
142
self . as_vec ( )
147
143
}
148
144
#[ inline]
149
- fn container_as_str < ' a > ( & ' a self ) -> & ' a str {
150
- self . as_str ( ) . unwrap ( )
151
- }
152
- #[ inline]
153
- fn container_as_str_opt < ' a > ( & ' a self ) -> Option < & ' a str > {
145
+ fn container_as_str < ' a > ( & ' a self ) -> Option < & ' a str > {
154
146
self . as_str ( )
155
147
}
156
148
#[ inline]
@@ -165,7 +157,7 @@ impl GenericPathUnsafe for Path {
165
157
/// Raises the `str::not_utf8` condition if not valid UTF-8.
166
158
#[ inline]
167
159
unsafe fn new_unchecked < T : BytesContainer > ( path : T ) -> Path {
168
- let ( prefix, path) = Path :: normalize_ ( path. container_as_str ( ) ) ;
160
+ let ( prefix, path) = Path :: normalize_ ( path. container_as_str ( ) . unwrap ( ) ) ;
169
161
assert ! ( !path. is_empty( ) ) ;
170
162
let mut ret = Path { repr : path, prefix : prefix, sepidx : None } ;
171
163
ret. update_sepidx ( ) ;
@@ -178,7 +170,7 @@ impl GenericPathUnsafe for Path {
178
170
///
179
171
/// Raises the `str::not_utf8` condition if not valid UTF-8.
180
172
unsafe fn set_filename_unchecked < T : BytesContainer > ( & mut self , filename : T ) {
181
- let filename = filename. container_as_str ( ) ;
173
+ let filename = filename. container_as_str ( ) . unwrap ( ) ;
182
174
match self . sepidx_or_prefix_len ( ) {
183
175
None if ".." == self . repr => {
184
176
let mut s = str:: with_capacity ( 3 + filename. len ( ) ) ;
@@ -224,7 +216,7 @@ impl GenericPathUnsafe for Path {
224
216
/// the new path is relative to. Otherwise, the new path will be treated
225
217
/// as if it were absolute and will replace the receiver outright.
226
218
unsafe fn push_unchecked < T : BytesContainer > ( & mut self , path : T ) {
227
- let path = path. container_as_str ( ) ;
219
+ let path = path. container_as_str ( ) . unwrap ( ) ;
228
220
fn is_vol_abs ( path : & str , prefix : Option < PathPrefix > ) -> bool {
229
221
// assume prefix is Some(DiskPrefix)
230
222
let rest = path. slice_from ( prefix_len ( prefix) ) ;
@@ -311,7 +303,7 @@ impl GenericPathUnsafe for Path {
311
303
impl GenericPath for Path {
312
304
#[ inline]
313
305
fn new_opt < T : BytesContainer > ( path : T ) -> Option < Path > {
314
- let s = path. container_as_str_opt ( ) ;
306
+ let s = path. container_as_str ( ) ;
315
307
match s {
316
308
None => None ,
317
309
Some ( s) => {
0 commit comments