@@ -38,7 +38,7 @@ impl KeyringProvider {
38
38
#[ instrument( skip_all, fields( url = % url. to_string( ) , username) ) ]
39
39
pub async fn fetch (
40
40
& self ,
41
- url : & DisplaySafeUrlRef < ' _ > ,
41
+ url : DisplaySafeUrlRef < ' _ > ,
42
42
username : Option < & str > ,
43
43
) -> Option < Credentials > {
44
44
// Validate the request
@@ -229,7 +229,7 @@ mod tests {
229
229
let keyring = KeyringProvider :: empty ( ) ;
230
230
// Panics due to debug assertion; returns `None` in production
231
231
let result = std:: panic:: AssertUnwindSafe (
232
- keyring. fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) ) ,
232
+ keyring. fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) ) ,
233
233
)
234
234
. catch_unwind ( )
235
235
. await ;
@@ -242,7 +242,7 @@ mod tests {
242
242
let keyring = KeyringProvider :: empty ( ) ;
243
243
// Panics due to debug assertion; returns `None` in production
244
244
let result = std:: panic:: AssertUnwindSafe (
245
- keyring. fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( url. username ( ) ) ) ,
245
+ keyring. fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( url. username ( ) ) ) ,
246
246
)
247
247
. catch_unwind ( )
248
248
. await ;
@@ -255,7 +255,7 @@ mod tests {
255
255
let keyring = KeyringProvider :: empty ( ) ;
256
256
// Panics due to debug assertion; returns `None` in production
257
257
let result = std:: panic:: AssertUnwindSafe (
258
- keyring. fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( url. username ( ) ) ) ,
258
+ keyring. fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( url. username ( ) ) ) ,
259
259
)
260
260
. catch_unwind ( )
261
261
. await ;
@@ -267,7 +267,7 @@ mod tests {
267
267
let url = Url :: parse ( "https://example.com" ) . unwrap ( ) ;
268
268
let url = DisplaySafeUrlRef :: from ( & url) ;
269
269
let keyring = KeyringProvider :: empty ( ) ;
270
- let credentials = keyring. fetch ( & url, Some ( "user" ) ) ;
270
+ let credentials = keyring. fetch ( url, Some ( "user" ) ) ;
271
271
assert ! ( credentials. await . is_none( ) ) ;
272
272
}
273
273
@@ -277,7 +277,7 @@ mod tests {
277
277
let keyring = KeyringProvider :: dummy ( [ ( url. host_str ( ) . unwrap ( ) , "user" , "password" ) ] ) ;
278
278
assert_eq ! (
279
279
keyring
280
- . fetch( & DisplaySafeUrlRef :: from( & url) , Some ( "user" ) )
280
+ . fetch( DisplaySafeUrlRef :: from( & url) , Some ( "user" ) )
281
281
. await ,
282
282
Some ( Credentials :: basic(
283
283
Some ( "user" . to_string( ) ) ,
@@ -287,7 +287,7 @@ mod tests {
287
287
assert_eq ! (
288
288
keyring
289
289
. fetch(
290
- & DisplaySafeUrlRef :: from( & url. join( "test" ) . unwrap( ) ) ,
290
+ DisplaySafeUrlRef :: from( & url. join( "test" ) . unwrap( ) ) ,
291
291
Some ( "user" )
292
292
)
293
293
. await ,
@@ -303,7 +303,7 @@ mod tests {
303
303
let url = Url :: parse ( "https://example.com" ) . unwrap ( ) ;
304
304
let keyring = KeyringProvider :: dummy ( [ ( "other.com" , "user" , "password" ) ] ) ;
305
305
let credentials = keyring
306
- . fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) )
306
+ . fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) )
307
307
. await ;
308
308
assert_eq ! ( credentials, None ) ;
309
309
}
@@ -318,7 +318,7 @@ mod tests {
318
318
assert_eq ! (
319
319
keyring
320
320
. fetch(
321
- & DisplaySafeUrlRef :: from( & url. join( "foo" ) . unwrap( ) ) ,
321
+ DisplaySafeUrlRef :: from( & url. join( "foo" ) . unwrap( ) ) ,
322
322
Some ( "user" )
323
323
)
324
324
. await ,
@@ -329,7 +329,7 @@ mod tests {
329
329
) ;
330
330
assert_eq ! (
331
331
keyring
332
- . fetch( & DisplaySafeUrlRef :: from( & url) , Some ( "user" ) )
332
+ . fetch( DisplaySafeUrlRef :: from( & url) , Some ( "user" ) )
333
333
. await ,
334
334
Some ( Credentials :: basic(
335
335
Some ( "user" . to_string( ) ) ,
@@ -339,7 +339,7 @@ mod tests {
339
339
assert_eq ! (
340
340
keyring
341
341
. fetch(
342
- & DisplaySafeUrlRef :: from( & url. join( "bar" ) . unwrap( ) ) ,
342
+ DisplaySafeUrlRef :: from( & url. join( "bar" ) . unwrap( ) ) ,
343
343
Some ( "user" )
344
344
)
345
345
. await ,
@@ -355,7 +355,7 @@ mod tests {
355
355
let url = Url :: parse ( "https://example.com" ) . unwrap ( ) ;
356
356
let keyring = KeyringProvider :: dummy ( [ ( url. host_str ( ) . unwrap ( ) , "user" , "password" ) ] ) ;
357
357
let credentials = keyring
358
- . fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) )
358
+ . fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( "user" ) )
359
359
. await ;
360
360
assert_eq ! (
361
361
credentials,
@@ -370,7 +370,7 @@ mod tests {
370
370
async fn fetch_url_no_username ( ) {
371
371
let url = Url :: parse ( "https://example.com" ) . unwrap ( ) ;
372
372
let keyring = KeyringProvider :: dummy ( [ ( url. host_str ( ) . unwrap ( ) , "user" , "password" ) ] ) ;
373
- let credentials = keyring. fetch ( & DisplaySafeUrlRef :: from ( & url) , None ) . await ;
373
+ let credentials = keyring. fetch ( DisplaySafeUrlRef :: from ( & url) , None ) . await ;
374
374
assert_eq ! (
375
375
credentials,
376
376
Some ( Credentials :: basic(
@@ -385,14 +385,14 @@ mod tests {
385
385
let url = Url :: parse ( "https://example.com" ) . unwrap ( ) ;
386
386
let keyring = KeyringProvider :: dummy ( [ ( url. host_str ( ) . unwrap ( ) , "foo" , "password" ) ] ) ;
387
387
let credentials = keyring
388
- . fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( "bar" ) )
388
+ . fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( "bar" ) )
389
389
. await ;
390
390
assert_eq ! ( credentials, None ) ;
391
391
392
392
// Still fails if we have `foo` in the URL itself
393
393
let url =
Url :: parse ( "https://[email protected] " ) . unwrap ( ) ;
394
394
let credentials = keyring
395
- . fetch ( & DisplaySafeUrlRef :: from ( & url) , Some ( "bar" ) )
395
+ . fetch ( DisplaySafeUrlRef :: from ( & url) , Some ( "bar" ) )
396
396
. await ;
397
397
assert_eq ! ( credentials, None ) ;
398
398
}
0 commit comments