From f12a352b5009dacf71a5d29ad158285a0d0ae7a2 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 4 Jan 2022 18:15:04 -0800 Subject: chore: stricter clippy --- Cargo.toml | 2 +- src/main.rs | 10 ++++++++++ src/structures.rs | 2 ++ src/utils.rs | 9 ++++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 09bbc68..2bbc990 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "senpy-api" version = "0.1.0" authors = ["Fuwn "] -edition = "2018" +edition = "2021" #description = "" readme = "README.md" homepage = "https://github.com/senpy-club/api" 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> { let mut client = actix_web::client::Client::new() .get(GITHUB_API_ENDPOINT) @@ -33,10 +35,13 @@ pub async fn github_api() -> Result Vec { 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 { languages } +/// # Panics +/// if GitHub API is unresponsive pub async fn filter_images_by_language(language: &str) -> Vec { let mut images = vec![]; @@ -55,7 +62,7 @@ pub async fn filter_images_by_language(language: &str) -> Vec { // 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)); } } -- cgit v1.2.3