Skip to content

Commit

Permalink
Merge pull request #643 from gwenn/clippy
Browse files Browse the repository at this point in the history
Fix clippy warnings
  • Loading branch information
gwenn authored Jul 31, 2022
2 parents ca62587 + 26db0f1 commit 05f94b1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ mod test {
assert!(subtrie.is_some());
let subtrie = subtrie.unwrap();
let sub_result = subtrie.get(&evt);
assert!(sub_result.is_ok());
assert!(sub_result.unwrap().is_some());
let prefix = Event::from(KeyEvent::ctrl('O'));
let subtrie = trie.get_raw_descendant(&prefix);
Expand Down
64 changes: 28 additions & 36 deletions src/undo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,20 @@ impl Changeset {
let mut count = 0;
let mut waiting_for_begin = 0;
let mut undone = false;
loop {
if let Some(change) = self.undos.pop() {
match change {
Change::Begin => {
waiting_for_begin -= 1;
}
Change::End => {
waiting_for_begin += 1;
}
_ => {
change.undo(line);
undone = true;
}
};
self.redos.push(change);
} else {
break;
}
while let Some(change) = self.undos.pop() {
match change {
Change::Begin => {
waiting_for_begin -= 1;
}
Change::End => {
waiting_for_begin += 1;
}
_ => {
change.undo(line);
undone = true;
}
};
self.redos.push(change);
if waiting_for_begin <= 0 {
count += 1;
if count >= n {
Expand All @@ -292,24 +288,20 @@ impl Changeset {
pub fn redo(&mut self, line: &mut LineBuffer) -> bool {
let mut waiting_for_end = 0;
let mut redone = false;
loop {
if let Some(change) = self.redos.pop() {
match change {
Change::Begin => {
waiting_for_end += 1;
}
Change::End => {
waiting_for_end -= 1;
}
_ => {
change.redo(line);
redone = true;
}
};
self.undos.push(change);
} else {
break;
}
while let Some(change) = self.redos.pop() {
match change {
Change::Begin => {
waiting_for_end += 1;
}
Change::End => {
waiting_for_end -= 1;
}
_ => {
change.redo(line);
redone = true;
}
};
self.undos.push(change);
if waiting_for_end <= 0 {
break;
}
Expand Down

0 comments on commit 05f94b1

Please sign in to comment.