@@ -44,8 +44,7 @@ impl UserApi {
44
44
45
45
let client = reqwest:: Client :: builder ( )
46
46
. default_headers ( headers)
47
- . build ( )
48
- . unwrap ( ) ;
47
+ . build ( ) ?;
49
48
50
49
Ok ( Self { client } )
51
50
}
@@ -82,7 +81,7 @@ impl UserApi {
82
81
"query" : query,
83
82
} ) ;
84
83
85
- let query = serde_json:: to_string ( & json_data) . unwrap ( ) ;
84
+ let query = serde_json:: to_string ( & json_data) ? ;
86
85
87
86
let client = reqwest:: Client :: new ( ) ;
88
87
@@ -91,8 +90,7 @@ impl UserApi {
91
90
. body ( query)
92
91
. headers ( headers)
93
92
. send ( )
94
- . await
95
- . unwrap ( )
93
+ . await ?
96
94
. text ( )
97
95
. await
98
96
{
@@ -137,15 +135,14 @@ impl UserApi {
137
135
"query" : "query questionData($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n questionId\n questionFrontendId\n boundTopicId\n title\n titleSlug\n content\n translatedTitle\n translatedContent\n isPaidOnly\n canSeeQuestion\n difficulty\n likes\n dislikes\n isLiked\n similarQuestions\n exampleTestcases\n categoryTitle\n contributors {\n username\n profileUrl\n avatarUrl\n __typename\n }\n topicTags {\n name\n slug\n translatedName\n __typename\n }\n companyTagStats\n codeSnippets {\n lang\n langSlug\n code\n __typename\n }\n stats\n hints\n solution {\n id\n canSeeDetail\n paidOnly\n hasVideoSolution\n paidOnlyVideo\n __typename\n }\n status\n sampleTestCase\n metaData\n judgerAvailable\n judgeType\n mysqlSchemas\n enableRunCode\n enableTestMode\n enableDebugger\n envInfo\n libraryUrl\n adminUrl\n challengeQuestion {\n id\n date\n incompleteChallengeCount\n streakCount\n type\n __typename\n }\n __typename\n }\n }"
138
136
} ) ;
139
137
140
- let query = serde_json:: to_string ( & json_obj) . unwrap ( ) ;
138
+ let query = serde_json:: to_string ( & json_obj) ? ;
141
139
142
140
let full_data = match self
143
141
. client
144
142
. post ( "https://leetcode.com/graphql/" )
145
143
. body ( query)
146
144
. send ( )
147
- . await
148
- . unwrap ( )
145
+ . await ?
149
146
. json :: < ProblemFullData > ( )
150
147
. await
151
148
{
@@ -174,15 +171,14 @@ impl UserApi {
174
171
"operationName" : "problemsetQuestionList"
175
172
} ) ;
176
173
177
- let query = serde_json:: to_string ( & query) . unwrap ( ) ;
174
+ let query = serde_json:: to_string ( & query) ? ;
178
175
179
176
let task_info = self
180
177
. client
181
178
. get ( "https://leetcode.com/graphql/" )
182
179
. body ( query)
183
180
. send ( )
184
- . await
185
- . unwrap ( )
181
+ . await ?
186
182
. text ( )
187
183
. await ;
188
184
@@ -217,15 +213,14 @@ impl UserApi {
217
213
"operationName" : "problemsetQuestionList"
218
214
} ) ;
219
215
220
- let query = serde_json:: to_string ( & query) . unwrap ( ) ;
216
+ let query = serde_json:: to_string ( & query) ? ;
221
217
222
218
let task_info = self
223
219
. client
224
220
. get ( "https://leetcode.com/graphql/" )
225
221
. body ( query)
226
222
. send ( )
227
- . await
228
- . unwrap ( )
223
+ . await ?
229
224
. text ( )
230
225
. await ;
231
226
0 commit comments