51
51
. collect ( )
52
52
}
53
53
54
- fn serialize_holiday_dates < S > ( dates : & Vec < NaiveDate > , serializer : S ) -> Result < S :: Ok , S :: Error >
54
+ fn serialize_holiday_dates < S > ( dates : & [ NaiveDate ] , serializer : S ) -> Result < S :: Ok , S :: Error >
55
55
where
56
56
S : Serializer ,
57
57
{
70
70
let timestamp = i64:: deserialize ( deserializer) ?;
71
71
Utc . timestamp_opt ( timestamp, 0 )
72
72
. single ( )
73
- . map ( |ts| Some ( ts ) )
73
+ . map ( Some )
74
74
. ok_or_else ( || serde:: de:: Error :: custom ( format ! ( "Invalid Unix timestamp: {}" , timestamp) ) )
75
75
}
76
76
@@ -308,8 +308,6 @@ pub struct Following {
308
308
pub struct User {
309
309
id : u32 ,
310
310
username : String ,
311
- first_name : String ,
312
- last_name : String ,
313
311
reputation : f64 ,
314
312
following : Option < u32 > ,
315
313
followers : Option < u32 > ,
@@ -335,14 +333,6 @@ impl User {
335
333
& self . username
336
334
}
337
335
338
- pub fn get_first_name ( & self ) -> & str {
339
- & self . first_name
340
- }
341
-
342
- pub fn get_last_name ( & self ) -> & str {
343
- & self . last_name
344
- }
345
-
346
336
pub fn get_reputation ( & self ) -> f64 {
347
337
self . reputation
348
338
}
@@ -783,20 +773,6 @@ impl TradingView {
783
773
. expect ( "Username not found when parsing user from token" )
784
774
. to_string ( ) ;
785
775
786
- let first_name = response_body
787
- . split ( "first_name\" :\" " )
788
- . nth ( 1 )
789
- . and_then ( |s| s. split ( '\"' ) . next ( ) )
790
- . expect ( "First name not found when parsing user from token" )
791
- . to_string ( ) ;
792
-
793
- let last_name = response_body
794
- . split ( "last_name\" :\" " )
795
- . nth ( 1 )
796
- . and_then ( |s| s. split ( '\"' ) . next ( ) )
797
- . expect ( "Last name not found when parsing user from token" )
798
- . to_string ( ) ;
799
-
800
776
let reputation = response_body
801
777
. split ( "reputation\" :" )
802
778
. nth ( 1 )
@@ -852,8 +828,6 @@ impl TradingView {
852
828
Ok ( User {
853
829
id,
854
830
username,
855
- first_name,
856
- last_name,
857
831
session : Some ( session. to_string ( ) ) ,
858
832
signature : Some ( signature. to_string ( ) ) ,
859
833
reputation,
@@ -1150,8 +1124,6 @@ mod tests {
1150
1124
"user" : {
1151
1125
"id" : 123 ,
1152
1126
"username" : "test" ,
1153
- "first_name" : "Test" ,
1154
- "last_name" : "User" ,
1155
1127
"reputation" : 5.0 ,
1156
1128
"following" : 10 ,
1157
1129
"followers" : 20 ,
@@ -1173,8 +1145,6 @@ mod tests {
1173
1145
1174
1146
assert_eq ! ( user. id, 123 ) ;
1175
1147
assert_eq ! ( user. username, "test" ) ;
1176
- assert_eq ! ( user. first_name, "Test" ) ;
1177
- assert_eq ! ( user. last_name, "User" ) ;
1178
1148
assert_eq ! ( user. reputation, 5.0 ) ;
1179
1149
assert_eq ! ( user. following, Some ( 10 ) ) ;
1180
1150
assert_eq ! ( user. signature, Some ( "efgh" . to_string( ) ) ) ;
@@ -1220,8 +1190,6 @@ mod tests {
1220
1190
"user" : {
1221
1191
"id" : 123 ,
1222
1192
"username" : "test" ,
1223
- "first_name" : "Test" ,
1224
- "last_name" : "User" ,
1225
1193
"reputation" : 5.0 ,
1226
1194
"following" : 10 ,
1227
1195
"followers" : 20 ,
@@ -1251,8 +1219,6 @@ mod tests {
1251
1219
let json = r#"{
1252
1220
"id": 123,
1253
1221
"username": "test",
1254
- "first_name": "Test",
1255
- "last_name": "User",
1256
1222
"reputation": 5.0,
1257
1223
"following": 10,
1258
1224
"followers": 20,
0 commit comments