Skip to content

Commit

Permalink
Fix filter logic (!= to ==)
Browse files Browse the repository at this point in the history
  • Loading branch information
nivekuil committed Oct 30, 2016
1 parent f8fcab8 commit 8349842
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rm-improved"
version = "0.10.1"
version = "0.10.2"
authors = ["[email protected]"]
description = "rip: a safety-focused alternative to rm."
repository = "https://github.com/nivekuil/rip"
Expand Down
22 changes: 11 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit 8349842

Please sign in to comment.