clean code with clippy
This commit is contained in:
@ -103,18 +103,16 @@ fn fetch(api_key: &str) -> Result<Data, String> {
|
||||
let data: Result<Data, _> = response.into_json();
|
||||
|
||||
if let Ok(data) = data {
|
||||
return Ok(data);
|
||||
Ok(data)
|
||||
} else {
|
||||
return Err(format!(
|
||||
Err(format!(
|
||||
"Failed to parse the json received by {url}: {}",
|
||||
data.err().unwrap()
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
return Err(format!(
|
||||
"Could not fetch {url}, do you have internet? Maybe their server is down?"
|
||||
));
|
||||
}
|
||||
Err(_) => Err(format!(
|
||||
"Could not fetch {url}, do you have internet? Maybe their server is down?"
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user