@@ -262,7 +262,7 @@ fn list_netflix_names() {
262
262
263
263
expect_cert_dns_names (
264
264
ee,
265
- & [
265
+ [
266
266
"account.netflix.com" ,
267
267
"ca.netflix.com" ,
268
268
"netflix.ca" ,
@@ -288,7 +288,7 @@ fn invalid_subject_alt_names() {
288
288
289
289
expect_cert_dns_names (
290
290
data,
291
- & [
291
+ [
292
292
"account.netflix.com" ,
293
293
"ca.netflix.com" ,
294
294
"netflix.ca" ,
@@ -314,7 +314,7 @@ fn wildcard_subject_alternative_names() {
314
314
315
315
expect_cert_dns_names (
316
316
data,
317
- & [
317
+ [
318
318
"account.netflix.com" ,
319
319
"*.netflix.com" ,
320
320
"netflix.ca" ,
@@ -332,28 +332,15 @@ fn wildcard_subject_alternative_names() {
332
332
}
333
333
334
334
#[ cfg( feature = "alloc" ) ]
335
- fn expect_cert_dns_names ( cert_der : & [ u8 ] , expected_names : & [ & str ] ) {
336
- use std:: collections:: HashSet ;
337
-
335
+ fn expect_cert_dns_names < ' name > (
336
+ cert_der : & [ u8 ] ,
337
+ expected_names : impl IntoIterator < Item = & ' name str > ,
338
+ ) {
338
339
let der = CertificateDer :: from ( cert_der) ;
339
340
let cert = webpki:: EndEntityCert :: try_from ( & der)
340
341
. expect ( "should parse end entity certificate correctly" ) ;
341
342
342
- let expected_names: HashSet < _ > = expected_names. iter ( ) . cloned ( ) . collect ( ) ;
343
-
344
- let mut actual_names = cert
345
- . dns_names ( )
346
- . expect ( "should get all DNS names correctly for end entity cert" )
347
- . collect :: < Vec < _ > > ( ) ;
348
-
349
- // Ensure that converting the list to a set doesn't throw away
350
- // any duplicates that aren't supposed to be there
351
- assert_eq ! ( actual_names. len( ) , expected_names. len( ) ) ;
352
-
353
- let actual_names: std:: collections:: HashSet < & str > =
354
- actual_names. drain ( ..) . map ( |name| name. into ( ) ) . collect ( ) ;
355
-
356
- assert_eq ! ( actual_names, expected_names) ;
343
+ assert ! ( cert. dns_names( ) . unwrap( ) . eq( expected_names) )
357
344
}
358
345
359
346
#[ cfg( feature = "alloc" ) ]
0 commit comments