summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-06-23 09:08:57 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-06-23 09:08:57 +0200
commit4320977e4040d44dcdb346db1bf2d8ca6c5d316e (patch)
tree7d7f572f10a0d4300f3f124d3f267692d48cb44d
parent432e4ee649b41c957e9695d3e6961e35ca72ca39 (diff)
clippy: Use more effective zero-fill of vector
-rw-r--r--server/src/trans.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/src/trans.rs b/server/src/trans.rs
index 64e08de..bbf0600 100644
--- a/server/src/trans.rs
+++ b/server/src/trans.rs
@@ -9,7 +9,7 @@ use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{BufReader, Read};
-use std::iter::{repeat, IntoIterator};
+use std::iter::IntoIterator;
use std::path::Path;
use tokio::task::JoinSet;
@@ -112,10 +112,9 @@ fn push_translation(
unit: grit::TranslationUnit,
) {
let mut translation = String::new();
- let mut placeholder_offset = Vec::<usize>::with_capacity(string.placeholders.len());
// Fill offset vec with zeros, it's not guaranteed that they will be in the same order
// below so easier to index directly.
- placeholder_offset.extend(repeat(0).take(string.placeholders.len()));
+ let mut placeholder_offset = vec![0; string.placeholders.len()];
// There can be multiple placeholders with the same name, so when doing name lookup,
// skip the previous hits.