diff options
author | Teddy Wing | 2021-05-29 18:18:14 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-29 18:18:14 +0200 |
commit | be1b1f2a3356d6c3b72bbc9fe9b53552ccf3b8b5 (patch) | |
tree | 2edde3c83a4777dff7b3b76aec60a6187a0c96da | |
parent | 67d7632b900f7221c1a3fb1927cd97b7cb60c71e (diff) | |
download | reflectub-be1b1f2a3356d6c3b72bbc9fe9b53552ccf3b8b5.tar.bz2 |
github::fetch_repos(): Remove `unwrap`s
-rw-r--r-- | src/github.rs | 11 |
1 files changed, 4 insertions, 7 deletions
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<Vec<Repo>, Box<dyn std::error::Error>> { 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<Vec<Repo>, Box<dyn std::error::Error>> { "teddywing", ), ) - .send() - .unwrap() - .json::<Vec<Repo>>() - .unwrap(); + .send()? + .json::<Vec<Repo>>()?; Ok(repos) } |