rust: apply clippy suggestions

This commit is contained in:
Ryan Mulligan 2023-08-12 11:13:51 -07:00
parent d2f6ab6f2b
commit a81bdef4fc

View File

@ -13,20 +13,14 @@ fn fetch_repology(project_name: String) -> Result<json::JsonValue, &'static str>
.into_string()
.unwrap();
let json = json::parse(&body).unwrap();
match json {
json::JsonValue::Array(projects) => {
for project in projects {
match project {
json::JsonValue::Object(project_repo) => {
if project_repo["status"] == "newest" {
return Ok(project_repo.get("version").unwrap().clone());
}
}
_ => continue,
if let json::JsonValue::Array(projects) = json {
for project in projects {
if let json::JsonValue::Object(project_repo) = project {
if project_repo["status"] == "newest" {
return Ok(project_repo.get("version").unwrap().clone());
}
}
}
_ => (),
}
Err("Couldn't find")
}