Repository: google/OpenSK
File: src/ctap/storage.rs (Rust)

Code before:
            .unwrap();
        assert_eq!(
            persistent_store.min_pin_length().unwrap(),
            new_min_pin_length
        );
    }

    #[test]
    fn test_min_pin_length_rp_ids() {
        let mut rng = ThreadRng256 {};
        let mut persistent_store = PersistentStore::new(&mut rng);

        // The minimum PIN length RP IDs are initially at the default.
        assert_eq!(
            persistent_store.min_pin_length_rp_ids().unwrap(),
            DEFAULT_MIN_PIN_LENGTH_RP_IDS
        );

        // Changes by the setter are reflected by the getter.
        let mut rp_ids = vec![String::from("example.com")];
        assert_eq!(
            persistent_store.set_min_pin_length_rp_ids(rp_ids.clone()),
            Ok(())
        );
        for rp_id in DEFAULT_MIN_PIN_LENGTH_RP_IDS.iter() {
            let rp_id = rp_id.to_string().to_string();
            if !rp_ids.contains(&rp_id) {
                rp_ids.push(rp_id);
            }
        }
        assert_eq!(persistent_store.min_pin_length_rp_ids().unwrap(), rp_ids);
    }

    #[test]
    fn test_max_large_blob_array_size() {
        let mut rng = ThreadRng256 {};
        let persistent_store = PersistentStore::new(&mut rng);

        #[allow(clippy::assertions_on_constants)]
        {
            assert!(MAX_LARGE_BLOB_ARRAY_SIZE >= 1024);
        }
        assert!(
            MAX_LARGE_BLOB_ARRAY_SIZE
                <= persistent_store.store.max_value_length()
                    * (key::LARGE_BLOB_SHARDS.end - key::LARGE_BLOB_SHARDS.start)
        );
    }

    #[test]
    fn test_commit_get_large_blob_array() {

Review comment (suggestion):
That's weird. You're sure you need both `to_string()`? What about `for &rp_id in ...`? Same for the loop above.

Code after:
            .unwrap();
        assert_eq!(
            persistent_store.min_pin_length().unwrap(),
            new_min_pin_length
        );
    }

    #[test]
    fn test_min_pin_length_rp_ids() {
        let mut rng = ThreadRng256 {};
        let mut persistent_store = PersistentStore::new(&mut rng);

        // The minimum PIN length RP IDs are initially at the default.
        assert_eq!(
            persistent_store.min_pin_length_rp_ids().unwrap(),
            DEFAULT_MIN_PIN_LENGTH_RP_IDS
        );

        // Changes by the setter are reflected by the getter.
        let mut rp_ids = vec![String::from("example.com")];
        assert_eq!(
            persistent_store.set_min_pin_length_rp_ids(rp_ids.clone()),
            Ok(())
        );
        for &rp_id in DEFAULT_MIN_PIN_LENGTH_RP_IDS.iter() {
            let rp_id = String::from(rp_id);
            if !rp_ids.contains(&rp_id) {
                rp_ids.push(rp_id);
            }
        }
        assert_eq!(persistent_store.min_pin_length_rp_ids().unwrap(), rp_ids);
    }

    #[test]
    fn test_max_large_blob_array_size() {
        let mut rng = ThreadRng256 {};
        let persistent_store = PersistentStore::new(&mut rng);

        #[allow(clippy::assertions_on_constants)]
        {
            assert!(MAX_LARGE_BLOB_ARRAY_SIZE >= 1024);
        }
        assert!(
            MAX_LARGE_BLOB_ARRAY_SIZE
                <= persistent_store.store.max_value_length()
                    * (key::LARGE_BLOB_SHARDS.end - key::LARGE_BLOB_SHARDS.start)
        );
    }

    #[test]
    fn test_commit_get_large_blob_array() {