From 4320977e4040d44dcdb346db1bf2d8ca6c5d316e Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 23 Jun 2025 09:08:57 +0200 Subject: clippy: Use more effective zero-fill of vector --- server/src/trans.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'server/src') 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::::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. -- cgit v1.2.3-70-g09d2