aboutsummaryrefslogtreecommitdiff
path: root/src/undo.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-06 10:24:54 +0100
committerAkshay <[email protected]>2021-04-06 10:24:54 +0100
commitc84c38544bc6e81f0b0482e4e82b6c95848c1a0c (patch)
tree3ae2f3387ba5ef56a7f7c3304dc029ae7845f175 /src/undo.rs
parent3f5b917c6ced370d940774b51ff89cec0d03c562 (diff)
apply clippy lints
Diffstat (limited to 'src/undo.rs')
-rw-r--r--src/undo.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/undo.rs b/src/undo.rs
index 1044c63..5effd79 100644
--- a/src/undo.rs
+++ b/src/undo.rs
@@ -67,9 +67,10 @@ where
67 if let Some(p) = self.position { 67 if let Some(p) = self.position {
68 self.position = p.checked_sub(1); 68 self.position = p.checked_sub(1);
69 // we want to return a clone and not a reference because push deletes the item 69 // we want to return a clone and not a reference because push deletes the item
70 return Some(self.operations[p as usize].clone()); 70 Some(self.operations[p as usize].clone())
71 } else {
72 None
71 } 73 }
72 return None;
73 } 74 }
74 75
75 pub fn redo(&mut self) -> Option<T> { 76 pub fn redo(&mut self) -> Option<T> {
@@ -82,7 +83,16 @@ where
82 self.position = Some(0); 83 self.position = Some(0);
83 return Some(self.operations[0].clone()); 84 return Some(self.operations[0].clone());
84 } 85 }
85 return None; 86 None
87 }
88}
89
90impl<T> std::default::Default for UndoStack<T>
91where
92 T: Clone,
93{
94 fn default() -> Self {
95 UndoStack::new()
86 } 96 }
87} 97}
88 98