fix E0599

error[E0599]: no method named remove_item found for struct Vec<files::File> in the current scope
This commit is contained in:
Bob Wen 2021-03-01 14:59:24 +08:00 committed by GitHub
parent 355d9a3101
commit 26ab54fe74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -952,7 +952,9 @@ impl Files {
let dirpath = self.directory.path.clone();
self.find_file_with_path(&dirpath).cloned()
.map(|placeholder| {
self.files.remove_item(&placeholder);
if let Some(pos) = self.files.iter().position(|x| *x == placeholder) {
self.files.remove(pos);
}
if self.len > 0 {
self.len -= 1;
}