@@ -189,7 +189,7 @@ impl AsciiStr {
189
189
/// assert_eq!("white \tspace \t", example.trim_left());
190
190
/// ```
191
191
pub fn trim_left ( & self ) -> & Self {
192
- & self [ self . slice . iter ( ) . take_while ( |a| a. is_whitespace ( ) ) . count ( ) ..]
192
+ & self [ self . chars ( ) . take_while ( |a| a. is_whitespace ( ) ) . count ( ) ..]
193
193
}
194
194
195
195
/// Returns an ASCII string slice with trailing whitespace removed.
@@ -201,8 +201,7 @@ impl AsciiStr {
201
201
/// assert_eq!(" \twhite \tspace", example.trim_right());
202
202
/// ```
203
203
pub fn trim_right ( & self ) -> & Self {
204
- let trimmed = self . slice
205
- . into_iter ( )
204
+ let trimmed = self . chars ( )
206
205
. rev ( )
207
206
. take_while ( |a| a. is_whitespace ( ) )
208
207
. count ( ) ;
@@ -215,7 +214,7 @@ impl AsciiStr {
215
214
#[ cfg( not( feature = "std" ) ) ]
216
215
pub fn eq_ignore_ascii_case ( & self , other : & Self ) -> bool {
217
216
self . len ( ) == other. len ( ) &&
218
- self . slice . iter ( ) . zip ( other. slice . iter ( ) ) . all ( |( a, b) | {
217
+ self . chars ( ) . zip ( other. chars ( ) ) . all ( |( a, b) | {
219
218
a. eq_ignore_ascii_case ( b)
220
219
} )
221
220
}
@@ -225,7 +224,7 @@ impl AsciiStr {
225
224
/// A replacement for `AsciiExt::make_ascii_uppercase()`.
226
225
#[ cfg( not( feature = "std" ) ) ]
227
226
pub fn make_ascii_uppercase ( & mut self ) {
228
- for a in & mut self . slice {
227
+ for a in & mut self {
229
228
* a = a. to_ascii_uppercase ( ) ;
230
229
}
231
230
}
@@ -235,7 +234,7 @@ impl AsciiStr {
235
234
/// A replacement for `AsciiExt::make_ascii_lowercase()`.
236
235
#[ cfg( not( feature = "std" ) ) ]
237
236
pub fn make_ascii_lowercase ( & mut self ) {
238
- for a in & mut self . slice {
237
+ for a in & mut self {
239
238
* a = a. to_ascii_lowercase ( ) ;
240
239
}
241
240
}
0 commit comments