Fix filter logic (!= to ==)

This commit is contained in:
Kevin Liu 2016-10-30 10:39:07 -07:00
parent f8fcab8e3b
commit 8349842d8a
2 changed files with 12 additions and 12 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "rm-improved"
version = "0.10.1"
version = "0.10.2"
authors = ["mail@nivekuil.com"]
description = "rip: a safety-focused alternative to rm."
repository = "https://github.com/nivekuil/rip"

View file

@ -361,19 +361,19 @@ fn get_last_bury<R: AsRef<Path>>(record: R) -> io::Result<String> {
// This could be cleaned up more if/when for loops can return a value
for entry in contents.lines().rev()
.map(record_entry)
.filter(|x| x.user != get_user()) {
// Check that the file is still in the graveyard.
// If it is, return the corresponding line.
if symlink_exists(entry.dest) {
if !graves_to_exhume.is_empty() {
delete_lines_from_record(&f, record, &graves_to_exhume)?;
.filter(|x| x.user == get_user()) {
// Check that the file is still in the graveyard.
// If it is, return the corresponding line.
if symlink_exists(entry.dest) {
if !graves_to_exhume.is_empty() {
delete_lines_from_record(&f, record, &graves_to_exhume)?;
}
return Ok(String::from(entry.dest))
} else {
// File is gone, mark the grave to be removed from the record
graves_to_exhume.push(String::from(entry.dest));
}
return Ok(String::from(entry.dest))
} else {
// File is gone, mark the grave to be removed from the record
graves_to_exhume.push(String::from(entry.dest));
}
}
if !graves_to_exhume.is_empty() {
delete_lines_from_record(&f, record, &graves_to_exhume)?;