diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 10 | ||||
| -rw-r--r-- | src/structures.rs | 2 | ||||
| -rw-r--r-- | src/utils.rs | 9 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index cd689ed..d0daf04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,16 @@ // SPDX-License-Identifier: GPL-3.0-only #![feature(type_ascription)] +#![deny( + warnings, + nonstandard_style, + unused, + future_incompatible, + rust_2018_idioms, + unsafe_code +)] +#![deny(clippy::all, clippy::pedantic)] // clippy::nursery +#![recursion_limit = "128"] #[macro_use] extern crate actix_web; diff --git a/src/structures.rs b/src/structures.rs index 3b5a59e..7aa684c 100644 --- a/src/structures.rs +++ b/src/structures.rs @@ -1,6 +1,8 @@ // Copyright (C) 2021-2021 the senpy club // SPDX-License-Identifier: GPL-3.0-only +#![allow(clippy::used_underscore_binding)] + use serde_derive::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] 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)); } } |