fn duplicate_claims_round_trip() {
        let claim = ClaimsSet::<InvalidPrivateClaim> {
            registered: RegisteredClaims {
                issuer: Some(not_err!(FromStr::from_str("https://www.acme.com"))),
                subject: Some(not_err!(FromStr::from_str("John Doe"))),
                audience: Some(SingleOrMultiple::Single(not_err!(FromStr::from_str(
                    "htts://acme-customer.com"
                )))),
                not_before: Some(1234.into()),
                ..Default::default()
            },
            private: InvalidPrivateClaim {
                sub: "John Doe".to_string(),
                company: "ACME".to_string(),
            },
        };

        let json = serde_json::to_string(&claim).unwrap();
        assert_eq!(2, json.matches("\"sub\"").count());

        let duplicate: Result<ClaimsSet<InvalidPrivateClaim>, _> = serde_json::from_str(&json);
        assert!(duplicate.is_err());
        let error = duplicate.unwrap_err().to_string();
        assert!(error.contains("duplicate field `sub`"));
    }
// serde's flatten will serialize them twice
serde's flatten will serialize them twice
serde ' s flatten will serialize them twice
fn duplicate_claims_round_trip() {
        let claim = ClaimsSet::<InvalidPrivateClaim> {
            registered: RegisteredClaims {
                issuer: Some(not_err!(FromStr::from_str("https://www.acme.com"))),
                subject: Some(not_err!(FromStr::from_str("John Doe"))),
                audience: Some(SingleOrMultiple::Single(not_err!(FromStr::from_str(
                    "htts://acme-customer.com"
                )))),
                not_before: Some(1234.into()),
                ..Default::default()
            },
            private: InvalidPrivateClaim {
                sub: "John Doe".to_string(),
                company: "ACME".to_string(),
            },
        };
        let json = serde_json::to_string(&claim).unwrap();
        assert_eq!(2, json.matches("\"sub\"").count());
        let duplicate: Result<ClaimsSet<InvalidPrivateClaim>, _> = serde_json::from_str(&json);
        assert!(duplicate.is_err());
        let error = duplicate.unwrap_err().to_string();
        assert!(error.contains("duplicate field `sub`"));
    }
fn duplicate_claims_round_trip ( ) { let claim = ClaimsSet :: < InvalidPrivateClaim > { registered : RegisteredClaims { issuer : Some ( not_err ! ( FromStr from_str ( " " ) ) ) , subject : Some ( not_err ! ( FromStr from_str ( " " ) ) ) , audience : Some ( SingleOrMultiple :: Single ( not_err ! ( FromStr from_str ( " " ) ) ) ) , not_before : Some ( 1234 . into ( ) ) , .. Default :: default ( ) } , private : InvalidPrivateClaim { sub : " " . to_string ( ) , company : " " . to_string ( ) , } , } ; let json = serde_json :: to_string ( & claim ) . unwrap ( ) ; assert_eq ! ( 2 json matches ( " \" \" " ) count ( ) ) ; let duplicate : Result < ClaimsSet < InvalidPrivateClaim > , _ > = serde_json :: from_str ( & json ) ; assert ! ( duplicate is_err ( ) ) ; let error = duplicate . unwrap_err ( ) . to_string ( ) ; assert ! ( error contains ( " " ) ) ; }
serde's flatten will serialize them twice
serde ' s flatten will serialize them twice