From 80a93aa74668d619f1e6f17165cef9e9a7844615 Mon Sep 17 00:00:00 2001 From: juanperias Date: Thu, 24 Jul 2025 15:03:07 -0400 Subject: [PATCH] refactor: clippy errors --- src/cangrebot.rs | 4 ++-- src/challenge.rs | 4 ++-- src/daily.rs | 4 ++-- src/lib.rs | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cangrebot.rs b/src/cangrebot.rs index c7f65ce..3db8b4a 100644 --- a/src/cangrebot.rs +++ b/src/cangrebot.rs @@ -11,7 +11,7 @@ pub async fn set_daily( challenge: DailyChallenge, client: &Client, ) { - let req = json!({ + let request = json!({ "title": format!("Reto #{day} - {}", challenge.question.title), "message": challenge.to_string(), "tag_name": challenge.question.difficulty.to_string(), @@ -21,7 +21,7 @@ pub async fn set_daily( .post(endpoint) .header("content-type", "application/json") .header("Authorization", apikey) - .body(serde_json::to_string(&req).unwrap()) + .body(serde_json::to_string(&request).unwrap()) .send() .await .inspect_err(|e| console_warn!("Reqwest Error: {e:?}")) diff --git a/src/challenge.rs b/src/challenge.rs index c412087..ec69ed2 100644 --- a/src/challenge.rs +++ b/src/challenge.rs @@ -95,7 +95,7 @@ impl Display for DailyChallenge { .unwrap_or_default(); f.write_fmt(format_args!( - r#"{parsed} + r"{parsed} > Enlace: > https://leetcode.com{} @@ -104,7 +104,7 @@ impl Display for DailyChallenge { > {test_cases} {code} -"#, +", self.link )) } diff --git a/src/daily.rs b/src/daily.rs index 1d0aaee..0580e5b 100644 --- a/src/daily.rs +++ b/src/daily.rs @@ -6,7 +6,7 @@ use crate::challenge::{DailyChallenge, GraphQLResponse}; const LETCODE_URL: &str = "https://leetcode.com"; -const DAILY_QUERY: &str = r#"query { +const DAILY_QUERY: &str = r"query { activeDailyCodingChallengeQuestion { date link @@ -30,7 +30,7 @@ const DAILY_QUERY: &str = r#"query { sampleTestCase } } -}"#; +}"; // Strategy to fetch from https://github.com/JacobLinCool/LeetCode-Query pub async fn get_daily(client: &Client) -> DailyChallenge { diff --git a/src/lib.rs b/src/lib.rs index 7a9e0dc..780e756 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,8 @@ mod cangrebot; mod challenge; mod daily; +/// # Panics +/// This may panic if the environment variable `APIKEY` is not found, or if `CANGREBOT_API_ENDPOINT` is also missing. #[event(scheduled)] pub async fn main(_e: ScheduledEvent, env: Env, _ctx: ScheduleContext) { // Custom panic