@@ -135,8 +135,7 @@ impl URLSearchParams {
135
135
if out. data . is_null ( ) {
136
136
return None ;
137
137
}
138
- let slice = core:: slice:: from_raw_parts ( out. data . cast ( ) , out. length ) ;
139
- Some ( core:: str:: from_utf8_unchecked ( slice) )
138
+ Some ( out. as_str ( ) )
140
139
}
141
140
}
142
141
@@ -165,7 +164,6 @@ impl URLSearchParams {
165
164
unsafe {
166
165
let strings = ffi:: ada_search_params_get_all ( self . 0 , key. as_ptr ( ) . cast ( ) , key. len ( ) ) ;
167
166
let size = ffi:: ada_strings_size ( strings) ;
168
-
169
167
URLSearchParamsEntry :: new ( strings, size)
170
168
}
171
169
}
@@ -200,13 +198,13 @@ pub struct URLSearchParamsKeysIterator<'a> {
200
198
_phantom : core:: marker:: PhantomData < & ' a str > ,
201
199
}
202
200
203
- impl < ' a > Drop for URLSearchParamsKeysIterator < ' a > {
201
+ impl Drop for URLSearchParamsKeysIterator < ' _ > {
204
202
fn drop ( & mut self ) {
205
203
unsafe { ffi:: ada_free_search_params_keys_iter ( self . iterator ) }
206
204
}
207
205
}
208
206
209
- impl < ' a > URLSearchParamsKeysIterator < ' a > {
207
+ impl URLSearchParamsKeysIterator < ' _ > {
210
208
/// Returns true if iterator has a next value.
211
209
pub fn has_next ( & self ) -> bool {
212
210
unsafe { ffi:: ada_search_params_keys_iter_has_next ( self . iterator ) }
@@ -236,7 +234,7 @@ impl<'a> URLSearchParamsKeysIterator<'a> {
236
234
}
237
235
}
238
236
239
- impl < ' a > Drop for URLSearchParamsValuesIterator < ' a > {
237
+ impl Drop for URLSearchParamsValuesIterator < ' _ > {
240
238
fn drop ( & mut self ) {
241
239
unsafe { ffi:: ada_free_search_params_values_iter ( self . iterator ) }
242
240
}
@@ -253,7 +251,7 @@ impl<'a> URLSearchParamsValuesIterator<'a> {
253
251
}
254
252
}
255
253
256
- impl < ' a > URLSearchParamsValuesIterator < ' a > {
254
+ impl URLSearchParamsValuesIterator < ' _ > {
257
255
/// Returns true if iterator has a next value.
258
256
pub fn has_next ( & self ) -> bool {
259
257
unsafe { ffi:: ada_search_params_values_iter_has_next ( self . iterator ) }
@@ -327,14 +325,12 @@ impl<'a> URLSearchParamsEntry<'a> {
327
325
328
326
unsafe {
329
327
let string = ffi:: ada_strings_get ( self . strings , index) ;
330
- let slice = core:: slice:: from_raw_parts ( string. data . cast ( ) , string. length ) ;
331
- Some ( core:: str:: from_utf8_unchecked ( slice) )
328
+ Some ( string. as_str ( ) )
332
329
}
333
330
}
334
331
}
335
332
336
- impl < ' a > Drop for URLSearchParamsEntry < ' a > {
337
- /// Automatically frees the underlying C pointer.
333
+ impl Drop for URLSearchParamsEntry < ' _ > {
338
334
fn drop ( & mut self ) {
339
335
unsafe { ffi:: ada_free_strings ( self . strings ) }
340
336
}
0 commit comments