I get the error, cannot borrow country_codes as mutable, as it is not declared as mutable
, down in the assert!
line:
#[tokio::test]
async fn integration_test_schema_country_codes() -> Result<()> {
let json = get_json("/v0/all").await?;
let country_codes = json.keys();
// cannot borrow `country_codes` as mutable, as it is not declared as mutable:
assert!(country_codes.all(|cc| is_valid_country_code(cc)));
Ok(())
}
Is there something about assert!
or borrowing that I don't understand? I'm definitely not mutating country_codes
because I'm only invoking .all()
on it. (?)
What's the cleanest way to write this?