Remove redundant min checks in Editor

This commit is contained in:
Héctor Ramón Jiménez 2020-07-11 00:11:45 +02:00
parent a1210c9dae
commit 4314ce36f4

View File

@ -18,7 +18,7 @@ impl<'a> Editor<'a> {
match self.cursor.selection(self.value) {
Some((left, right)) => {
self.cursor.move_left(self.value);
self.value.remove_many(left, right.min(self.value.len()));
self.value.remove_many(left, right);
}
_ => (),
}
@ -33,7 +33,7 @@ impl<'a> Editor<'a> {
match self.cursor.selection(self.value) {
Some((left, right)) => {
self.cursor.move_left(self.value);
self.value.remove_many(left, right.min(self.value.len()));
self.value.remove_many(left, right);
}
_ => (),
}
@ -47,7 +47,7 @@ impl<'a> Editor<'a> {
match self.cursor.selection(self.value) {
Some((start, end)) => {
self.cursor.move_left(self.value);
self.value.remove_many(start, end.min(self.value.len()));
self.value.remove_many(start, end);
}
None => {
let start = self.cursor.start(self.value);