Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4d7e82a

Browse files
committed
feat: refactoring
1 parent 46afa69 commit 4d7e82a

File tree

7 files changed

+9
-18
lines changed

7 files changed

+9
-18
lines changed

‎Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "leetcoderustapi"
3-
version = "1.0.5"
3+
version = "1.0.6"
44
authors = ["Kirill Melkozerov <k.melkozerov@gmail.com>"]
55
edition = "2021"
66
license = "MIT"
@@ -19,8 +19,9 @@ name = "leetcoderustapi"
1919
path = "src/lib.rs"
2020

2121
[dependencies]
22+
dotenv = "0.15.0"
2223
reqwest = { version = "0.11.18", features = ["json"] }
2324
serde = { version = "1.0.164", features = ["derive"] }
2425
serde_json = "1.0.99"
2526
thiserror = "1.0.41"
26-
tokio = { version = "1.29.1", features = ["time"] }
27+
tokio = { version = "1.29.1", features = ["time", "full"] }

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This Rust library provides a convenient way to interact with the LeetCode API, a
1111
Add the following line to your `Cargo.toml` file:
1212
```toml
1313
[dependencies]
14-
leetcoderustapi = "1.0.5"
14+
leetcoderustapi = "1.0.6"
1515
```
1616
## Usage
1717
### Authentication

‎src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub struct UserApi {
1919
client: reqwest::Client,
2020
}
2121

22-
#[allow(unused)]
2322
impl UserApi {
2423
pub async fn new(cookie: &str) -> Result<Self, Errors> {
2524
let mut headers = HeaderMap::new();

‎src/problem_actions.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
subm_send::{SubmExecutionResult, SubmissionCase, SubmissionCaseResp},
1212
subm_show::SubmList,
1313
test_send::{TestCase, TestCaseResp, TestExecutionResult},
14-
Descryption, Rate,
14+
Description, Rate,
1515
},
1616
ProgrammingLanguage,
1717
};
@@ -23,7 +23,6 @@ pub struct Problem {
2323
pub full_data: ProblemFullData,
2424
}
2525

26-
#[allow(unused)]
2726
impl Problem {
2827
pub async fn send_test(
2928
&self,
@@ -174,12 +173,12 @@ impl Problem {
174173
self.full_data.data.question.hints.clone()
175174
}
176175

177-
pub fn description(&self) -> Result<Descryption, Errors> {
176+
pub fn description(&self) -> Result<Description, Errors> {
178177
let descryption = json!({
179178
"name": self.full_data.data.question.title,
180179
"content": self.full_data.data.question.content
181180
});
182-
Ok(serde_json::from_value::<Descryption>(descryption)?)
181+
Ok(serde_json::from_value::<Description>(descryption)?)
183182
}
184183

185184
pub fn difficulty(&self) -> String {

‎src/problem_build.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ impl Default for Filters {
3434
}
3535
}
3636

37-
#[allow(unused)]
3837
impl ProblemBuilder {
3938
pub fn set_category(mut self, categoty: Category) -> ProblemBuilder {
4039
match categoty {
@@ -240,7 +239,6 @@ impl ProblemBuilder {
240239
}
241240

242241
#[derive(Debug)]
243-
#[allow(unused)]
244242
pub enum Category {
245243
AllTopics,
246244
Algorithms,
@@ -251,21 +249,19 @@ pub enum Category {
251249
}
252250

253251
#[derive(Debug)]
254-
#[allow(unused)]
255252
pub enum Difficulty {
256253
Easy,
257254
Medium,
258255
Hard,
259256
}
260257

261258
#[derive(Debug)]
262-
#[allow(unused)]
263259
pub enum Status {
264260
Todo,
265261
Solved,
266262
Attempted,
267263
}
268-
#[allow(unused)]
264+
269265
#[derive(Debug)]
270266
pub enum Tags {
271267
Array,

‎src/resources/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ pub mod test_send;
1515

1616
use serde::Deserialize;
1717

18-
#[allow(unused)]
1918
#[derive(Deserialize, Debug)]
2019
pub struct Rate {
2120
pub likes: u32,
2221
pub dislikes: u32,
2322
}
2423

25-
#[allow(unused)]
2624
#[derive(Deserialize, Debug)]
27-
pub struct Descryption {
25+
pub struct Description {
2826
pub name: String,
2927
pub content: String,
3028
}

‎src/resources/test_send.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ pub struct TestCase {
99
pub judge_type: String,
1010
}
1111

12-
#[allow(unused)]
1312
#[derive(Deserialize, Debug)]
1413
pub struct TestCaseResp {
1514
pub interpret_id: String,
1615
pub test_case: String,
1716
}
1817

19-
#[allow(unused)]
2018
#[derive(Deserialize, Debug)]
2119
pub struct TestExecutionResult {
2220
pub status_code: Option<u32>,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /