diff options
| author | Fuwn <[email protected]> | 2022-01-04 18:15:04 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-01-04 18:15:04 -0800 |
| commit | f12a352b5009dacf71a5d29ad158285a0d0ae7a2 (patch) | |
| tree | ca42458b429d7e18a28b1deb5267a432736fbe25 /src/utils.rs | |
| parent | feat(main.rs): ratelimit (100 requests/minute) (diff) | |
| download | api-f12a352b5009dacf71a5d29ad158285a0d0ae7a2.tar.xz api-f12a352b5009dacf71a5d29ad158285a0d0ae7a2.zip | |
chore: stricter clippy
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils.rs b/src/utils.rs index 275978d..a55ddc6 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -6,6 +6,8 @@ use crate::{ structures::GitHubAPIResponse, }; +/// # Errors +/// if GitHub API is unresponsive pub async fn github_api() -> Result<GitHubAPIResponse, Box<dyn std::error::Error>> { let mut client = actix_web::client::Client::new() .get(GITHUB_API_ENDPOINT) @@ -33,10 +35,13 @@ pub async fn github_api() -> Result<GitHubAPIResponse, Box<dyn std::error::Error ) } +/// # Panics +/// if GitHub API is unresponsive pub async fn filter_languages() -> Vec<String> { let mut languages = vec![]; for i in github_api().await.unwrap().tree { + #[allow(clippy::used_underscore_binding)] if i._type == "tree" { languages.push(i.path); } @@ -45,6 +50,8 @@ pub async fn filter_languages() -> Vec<String> { languages } +/// # Panics +/// if GitHub API is unresponsive pub async fn filter_images_by_language(language: &str) -> Vec<String> { let mut images = vec![]; @@ -55,7 +62,7 @@ pub async fn filter_images_by_language(language: &str) -> Vec<String> { // TODO: Fix this with type_ascription let x: Vec<&str> = i.path.split('/').collect(); if x[0] == language && i.path.contains('/') { - images.push(format!("{}{}", GITHUB_USER_CONTENT, i.path)) + images.push(format!("{}{}", GITHUB_USER_CONTENT, i.path)); } } |