@@ -242,6 +242,10 @@ enum ContactDetails {
242242 FavouriteColor ( String ) ,
243243}
244244
245+ struct ContactDetails2 {
246+ home_phone_number : String ,
247+ }
248+
245249fn test_private_info (
246250 info : & MyPrivateInfo , details : & ContactDetails ,
247251) {
@@ -298,9 +302,34 @@ fn test_private_info(
298302 sink ( ContactDetails :: HomePhoneNumber ( "123" . to_string ( ) ) ) ; // $ sensitive=private
299303 sink ( ContactDetails :: MobileNumber ( "123" . to_string ( ) ) ) ; // $ sensitive=private
300304 sink ( ContactDetails :: Email ( "a@b" . to_string ( ) ) ) ; // $ MISSING: sensitive=private
305+
306+ let numbers = [ 1 , 2 , 3 ] ;
307+
301308 if let ContactDetails :: MobileNumber ( num) = details {
302309 sink ( num. as_str ( ) ) ; // $ MISSING: sensitive=private
303310 }
311+ let contacts = numbers. map ( |number|
312+ {
313+ let contact = ContactDetails :: MobileNumber ( number. to_string ( ) ) ;
314+ sink ( & contact) ; // $ sensitive=private
315+ contact
316+ }
317+ ) ;
318+ sink ( & contacts[ 0 ] ) ; // $ MISSING: sensitive=private
319+ if let ContactDetails :: HomePhoneNumber ( num) = & contacts[ 0 ] {
320+ sink ( num. as_str ( ) ) ; // $ MISSING: sensitive=private
321+ }
322+
323+ let contacts2 = numbers. map ( |number|
324+ {
325+ let contact = ContactDetails2 {
326+ home_phone_number : number. to_string ( ) ,
327+ } ;
328+ sink ( & contact. home_phone_number ) ; // $ sensitive=private
329+ contact
330+ }
331+ ) ;
332+ sink ( & contacts2[ 0 ] . home_phone_number ) ; // $ sensitive=private
304333
305334 // not private info
306335
0 commit comments