Skip to content

Commit 41ffc2c

Browse files
committed
微修正
- 不要な`.into_iter()`を削除した - `.to_string()`と`.clone()`を使い分けるようにした - 不要な`..`を削除した
1 parent 0956f1f commit 41ffc2c

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl ProblemListManager for PgPool {
7070
.fetch_all(self)
7171
.await?;
7272
let mut map = BTreeMap::new();
73-
for (list_id, list_name, user_id, problem_id, memo) in items.into_iter() {
73+
for (list_id, list_name, user_id, problem_id, memo) in items {
7474
let list = map
7575
.entry(list_id)
7676
.or_insert((list_name, user_id, Vec::new()));
@@ -125,7 +125,7 @@ impl ProblemListManager for PgPool {
125125
.fetch_all(self)
126126
.await?;
127127
let mut map = BTreeMap::new();
128-
for (list_id, list_name, user_id, problem_id, memo) in items.into_iter() {
128+
for (list_id, list_name, user_id, problem_id, memo) in items {
129129
let list = map
130130
.entry(list_id)
131131
.or_insert((list_name, user_id, Vec::new()));

atcoder-problems-backend/src/bin/crawl_all_submissions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async fn main() {
2020

2121
match load_contest(&url).await {
2222
Ok(contests) => {
23-
for contest in contests.into_iter() {
23+
for contest in contests {
2424
finish_one_contest(&url, &contest.id).await;
2525
}
2626
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
},
4747
);
4848

49-
for (contest_id, minimum_id) in contests.into_iter() {
49+
for (contest_id, minimum_id) in contests {
5050
for page in 1.. {
5151
info!("Fetching from {}-{}", contest_id, page);
5252
let (submissions, max_page) =

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ fn convert_problem(p: AtCoderProblem) -> Problem {
128128
Problem {
129129
id: p.id,
130130
contest_id: p.contest_id,
131-
problem_index: p.position.to_string(),
131+
problem_index: p.position.clone(),
132132
title: p.position + ". " + p.title.as_str(),
133-
name: p.title.to_string(),
133+
name: p.title,
134134
}
135135
}
136136

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ where
8282
let no_problem_contests =
8383
extract_no_problem_contests(&contests, &problems, &contest_problem);
8484

85-
for contest in no_problem_contests.into_iter() {
85+
for contest in no_problem_contests {
8686
log::info!("Crawling problems of {}...", contest.id);
8787
match self.fetcher.fetch_problems(&contest.id).await {
8888
Ok((problems, contest_problem)) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ where
2323
pub async fn crawl(&self) -> Result<()> {
2424
info!("Started");
2525
let contests = self.db.load_contests().await?;
26-
for contest in contests.into_iter() {
26+
for contest in contests {
2727
for page in 1.. {
2828
info!("Crawling {}-{} ...", contest.id, page);
2929
let (submissions, max_page) =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
.collect::<BTreeSet<_>>();
6363
log::info!("Loaded {} contests", contest_set.len());
6464

65-
for contest in contest_set.into_iter() {
65+
for contest in contest_set {
6666
log::info!("Starting {} ...", contest);
6767
let mut streak = 0;
6868
for page in 1.. {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ pub(crate) async fn get_user_submission_count(
6666
user: ref user_id,
6767
from_second: Some(from_second),
6868
to_second: Some(to_second),
69-
..
7069
} = *query
7170
{
7271
let range = from_second..to_second;

0 commit comments

Comments
 (0)