summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-06-23 09:07:48 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-06-23 09:07:48 +0200
commitaa131024ab25c6c8c5e61ddcb195def671a62a18 (patch)
treeb0b3a7a6a7c79ebfcb82c542347a7059fcba38a9 /server
parent83c24934dc0ad18b1ed1696af3949b62146a4f22 (diff)
clippy: Use more rusty for loops
Diffstat (limited to 'server')
-rw-r--r--server/src/main.rs3
-rw-r--r--server/src/trans.rs4
2 files changed, 3 insertions, 4 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 902d023..639bf5c 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -186,8 +186,7 @@ async fn project(
// Remove linebreaks and potential openssh wrapper
fn cleanup_key(key: &str) -> String {
let mut ret = String::with_capacity(key.len());
- let mut lines = key.lines();
- while let Some(line) = lines.next() {
+ for line in key.lines() {
match line {
"-----BEGIN OPENSSH PRIVATE KEY-----" | "-----END OPENSSH PRIVATE KEY-----" => {}
_ => ret.push_str(line),
diff --git a/server/src/trans.rs b/server/src/trans.rs
index 3f47c8b..64e08de 100644
--- a/server/src/trans.rs
+++ b/server/src/trans.rs
@@ -226,8 +226,8 @@ where
let mut id_to_string =
HashMap::<i64, usize>::with_capacity(translation_ids.len() - first_index);
- for i in first_index..translation_ids.len() {
- id_to_string.insert(translation_ids[i], i);
+ for (i, id) in translation_ids.iter().enumerate().skip(first_index) {
+ id_to_string.insert(*id, i);
}
while let Some(res) = translation_tasks.join_next().await {