Use ? instead of match where appropriate

This commit is contained in:
Neshura 2023-08-03 21:38:22 +02:00
parent 17d375a5dc
commit 7f717d30b7
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
2 changed files with 10 additions and 28 deletions
src/config

View file

@ -102,12 +102,9 @@ impl Config {
let mut post_queue: Vec<CreatePost> = vec![];
match self.feeds.iter().map(|feed| {
let res = match CLIENT
let res = CLIENT
.get(feed.feed_url.clone())
.send() {
Ok(data) => data.text().unwrap(),
Err(e) => return Err(e)
};
.send()?.text()?;
let data: FeedData = serde_json::from_str(&res).unwrap();
@ -281,13 +278,10 @@ impl CommunitiesVector {
..Default::default()
};
let res = match CLIENT
let res = CLIENT
.get(base.clone() + "/api/v3/community/list")
.query(&params)
.send() {
Ok(data) => data.text().unwrap(),
Err(e) => return Err(e)
};
.send()?.text()?;
let site_data: ListCommunitiesResponse = serde_json::from_str(&res).unwrap();