Skip to content

Commit 28b1e8c

Browse files
committed
微修正
# Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Fri Apr 29 17:01:59 2022 +0900 # # interactive rebase in progress; onto 58aed3e # Last commands done (6 commands done): # edit dbd193b5 src/server/problem_list.rsを削除 # edit 7f28b973 微修正 # No commands remaining. # You are currently editing a commit while rebasing branch 'tweak' on '58aed3e8'. # # Changes to be committed: # modified: src/server/user_submissions.rs # # Untracked files: # cargo-timing.html #
1 parent b411553 commit 28b1e8c

File tree

9 files changed

+22
-30
lines changed

9 files changed

+22
-30
lines changed

atcoder-problems-backend/atcoder-client/src/atcoder/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ mod tests {
6464
contest_id: "arc102".to_string(),
6565
};
6666
assert_eq!(
67-
"https://atcoder.jp/contests/arc102/tasks/arc102_c".to_string(),
67+
"https://atcoder.jp/contests/arc102/tasks/arc102_c",
6868
problem.url()
6969
);
7070
}

atcoder-problems-backend/sql-client/src/internal/problem_list_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl ProblemListManager for PgPool {
165165
",
166166
)
167167
.bind(internal_user_id)
168-
.bind(new_list_id.as_str())
168+
.bind(&new_list_id)
169169
.bind(name)
170170
.execute(self)
171171
.await?;

atcoder-problems-backend/sql-client/tests/test_language_count.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,5 @@ async fn test_language_count() {
255255
]
256256
);
257257
let languages = pool.load_languages().await.unwrap();
258-
assert_eq!(
259-
languages,
260-
vec![
261-
"language1".to_owned(),
262-
"language2".to_owned(),
263-
"Perl".to_owned(),
264-
"Raku".to_owned(),
265-
]
266-
);
258+
assert_eq!(languages, ["language1", "language2", "Perl", "Raku"]);
267259
}

atcoder-problems-backend/sql-client/tests/test_simple_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async fn test_insert_contests() {
1818
.unwrap();
1919

2020
let contests = pool.load_contests().await.unwrap();
21-
assert_eq!(contests[0].id.as_str(), "contest1");
21+
assert_eq!(contests[0].id, "contest1");
2222

2323
pool.insert_contests(&[Contest {
2424
id: "contest1".to_string(),
@@ -46,7 +46,7 @@ async fn test_insert_problems() {
4646
.unwrap();
4747

4848
let problems = pool.load_problems().await.unwrap();
49-
assert_eq!(problems[0].id.as_str(), "problem1");
49+
assert_eq!(problems[0].id, "problem1");
5050

5151
pool.insert_problems(&[Problem {
5252
id: "problem1".to_string(),

atcoder-problems-backend/sql-client/tests/test_streak.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ async fn test_streak_ranking() {
4949
// load streak count in range
5050
let rank_1st_to_3rd = pool.load_streak_count_in_range(0..3).await.unwrap();
5151
assert_eq!(rank_1st_to_3rd.len(), 3);
52-
assert_eq!(rank_1st_to_3rd[0].user_id, "user1".to_owned());
52+
assert_eq!(rank_1st_to_3rd[0].user_id, "user1");
5353
assert_eq!(rank_1st_to_3rd[0].streak, 2);
54-
assert_eq!(rank_1st_to_3rd[2].user_id, "user3".to_owned());
54+
assert_eq!(rank_1st_to_3rd[2].user_id, "user3");
5555
assert_eq!(rank_1st_to_3rd[2].streak, 1);
5656

5757
let rank_3rd_to_4th = pool.load_streak_count_in_range(2..4).await.unwrap();
5858
assert_eq!(rank_3rd_to_4th.len(), 2);
59-
assert_eq!(rank_3rd_to_4th[0].user_id, "user3".to_owned());
59+
assert_eq!(rank_3rd_to_4th[0].user_id, "user3");
6060
assert_eq!(rank_3rd_to_4th[0].streak, 1);
6161
assert_eq!(
6262
rank_3rd_to_4th[1],

atcoder-problems-backend/sql-client/tests/test_submission_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ async fn test_submission_client() {
7979
};
8080
let submissions = pool.get_submissions(request).await.unwrap();
8181
assert_eq!(submissions.len(), 2);
82-
assert_eq!(submissions[0].result, "WA".to_owned());
83-
assert_eq!(submissions[1].result, "AC".to_owned());
82+
assert_eq!(submissions[0].result, "WA");
83+
assert_eq!(submissions[1].result, "AC");
8484

8585
let request = SubmissionRequest::FromUserAndTime {
8686
user_id: "usEr1",
@@ -149,8 +149,8 @@ async fn test_update_submissions() {
149149
.await
150150
.unwrap();
151151
assert_eq!(submissions.len(), 1);
152-
assert_eq!(submissions[0].user_id, "old_user_name".to_owned());
153-
assert_eq!(submissions[0].result, "WJ".to_owned());
152+
assert_eq!(submissions[0].user_id, "old_user_name");
153+
assert_eq!(submissions[0].result, "WJ");
154154
assert_eq!(submissions[0].point, 0.0);
155155
assert_eq!(submissions[0].execution_time, None);
156156

@@ -188,8 +188,8 @@ async fn test_update_submissions() {
188188
.await
189189
.unwrap();
190190
assert_eq!(submissions.len(), 1);
191-
assert_eq!(submissions[0].user_id, "new_user_name".to_owned());
192-
assert_eq!(submissions[0].result, "AC".to_owned());
191+
assert_eq!(submissions[0].user_id, "new_user_name");
192+
assert_eq!(submissions[0].result, "AC");
193193
assert_eq!(submissions[0].point, 100.0);
194194
assert_eq!(submissions[0].execution_time, Some(1));
195195
}

atcoder-problems-backend/src/crawler/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ mod tests {
145145
position: "A".to_owned(),
146146
};
147147
let p = convert_problem(p);
148-
assert_eq!(p.id, "id".to_owned());
149-
assert_eq!(p.contest_id, "contest_id".to_owned());
150-
assert_eq!(p.title, "A. title".to_owned());
148+
assert_eq!(p.id, "id");
149+
assert_eq!(p.contest_id, "contest_id");
150+
assert_eq!(p.title, "A. title");
151151
}
152152
}

atcoder-problems-backend/src/server/user_submissions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub(crate) async fn get_user_submission_count(
7171
{
7272
let range = from_second..to_second;
7373
let count = pool
74-
.get_user_submission_count(&user_id, range)
74+
.get_user_submission_count(user_id, range)
7575
.await
7676
.map_err(error::ErrorInternalServerError)?;
7777

atcoder-problems-backend/tests/test_server_e2e_submissions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ async fn test_user_submissions() {
5454
let submissions: Vec<Submission> = test::call_and_read_body_json(&app, request).await;
5555

5656
assert_eq!(submissions.len(), 5);
57-
assert!(submissions.iter().all(|s| s.user_id.as_str() == "u1"));
57+
assert!(submissions.iter().all(|s| s.user_id == "u1"));
5858

5959
let response = test::TestRequest::get()
6060
.uri("/atcoder-api/results?user=u2")
6161
.to_request();
6262
let submissions: Vec<Submission> = test::call_and_read_body_json(&app, response).await;
6363

6464
assert_eq!(submissions.len(), 5);
65-
assert!(submissions.iter().all(|s| s.user_id.as_str() == "u2"));
65+
assert!(submissions.iter().all(|s| s.user_id == "u2"));
6666
}
6767

6868
#[actix_web::test]
@@ -83,15 +83,15 @@ async fn test_user_submissions_fromtime() {
8383
let submissions: Vec<Submission> = test::call_and_read_body_json(&app, request).await;
8484

8585
assert_eq!(submissions.len(), 2);
86-
assert!(submissions.iter().all(|s| s.user_id.as_str() == "u1"));
86+
assert!(submissions.iter().all(|s| s.user_id == "u1"));
8787

8888
let request = test::TestRequest::get()
8989
.uri("/atcoder-api/v3/user/submissions?user=u2&from_second=6")
9090
.to_request();
9191
let submissions: Vec<Submission> = test::call_and_read_body_json(&app, request).await;
9292

9393
assert_eq!(submissions.len(), 3);
94-
assert!(submissions.iter().all(|s| s.user_id.as_str() == "u2"));
94+
assert!(submissions.iter().all(|s| s.user_id == "u2"));
9595
assert_eq!(submissions[0].epoch_second, 6);
9696
assert_eq!(submissions[1].epoch_second, 7);
9797
assert_eq!(submissions[2].epoch_second, 200);

0 commit comments

Comments
 (0)