fix: correct Vec capacity allocation caused by variable name shadowing (#2139)

This commit is contained in:
qumn 2025-01-01 22:45:32 +08:00 committed by GitHub
parent ef599a160a
commit 40fea8521e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,7 +61,7 @@ impl Files {
let (first, rest) = entries.split_at(entries.len() / 3);
let (second, third) = rest.split_at(entries.len() / 3);
async fn go(entries: &[DirEntry]) -> Vec<File> {
let mut files = Vec::with_capacity(entries.len() / 3 + 1);
let mut files = Vec::with_capacity(entries.len());
for entry in entries {
let url = Url::from(entry.path());
files.push(match entry.metadata().await {