This commit is contained in:
sxyazi 2023-11-09 08:32:01 +08:00
parent 67fcb484fb
commit 9ec0f830f6
No known key found for this signature in database
2 changed files with 2 additions and 4 deletions

View file

@ -4,7 +4,7 @@ use anyhow::Result;
use tokio::fs; use tokio::fs;
use yazi_shared::{Cha, ChaMeta, Url}; use yazi_shared::{Cha, ChaMeta, Url};
#[derive(Clone, Debug)] #[derive(Clone, Debug, Default)]
pub struct File { pub struct File {
pub url: Url, pub url: Url,
pub cha: Cha, pub cha: Cha,

View file

@ -72,11 +72,9 @@ impl FilesSorter {
if self.reverse { ordering.reverse() } else { ordering } if self.reverse { ordering.reverse() } else { ordering }
}); });
let dummy = File { url: Default::default(), cha: Default::default(), link_to: None };
let mut new = Vec::with_capacity(indices.len()); let mut new = Vec::with_capacity(indices.len());
for i in indices { for i in indices {
new.push(mem::replace(&mut items[i], dummy.clone())); new.push(mem::take(&mut items[i]));
} }
*items = new; *items = new;
} }