From be1b1f2a3356d6c3b72bbc9fe9b53552ccf3b8b5 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 May 2021 18:18:14 +0200 Subject: github::fetch_repos(): Remove `unwrap`s --- src/github.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/github.rs') diff --git a/src/github.rs b/src/github.rs index ccbcf1c..ec00420 100644 --- a/src/github.rs +++ b/src/github.rs @@ -23,13 +23,12 @@ pub struct Repo { pub fn fetch_repos() -> Result, Box> { let mut headers = reqwest::header::HeaderMap::new(); - headers.insert("Accept", "application/vnd.github.v3+json".parse().unwrap()); + headers.insert("Accept", "application/vnd.github.v3+json".parse()?); let client = ClientBuilder::new() .user_agent(USER_AGENT) .default_headers(headers) - .build() - .unwrap(); + .build()?; let repos = client.request( reqwest::Method::GET, @@ -38,10 +37,8 @@ pub fn fetch_repos() -> Result, Box> { "teddywing", ), ) - .send() - .unwrap() - .json::>() - .unwrap(); + .send()? + .json::>()?; Ok(repos) } -- cgit v1.2.3