From fbeded8ac543613b89af2ed7fd856e978493cde4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 6 Jan 2017 16:26:31 -0800 Subject: Remove need for inclusive ranges --- src/selection.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/selection.rs') diff --git a/src/selection.rs b/src/selection.rs index ebc84bee..ff587b9d 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -19,9 +19,8 @@ //! when text is added/removed/scrolled on the screen. The selection should //! also be cleared if the user clicks off of the selection. use std::mem; -use std::ops::RangeInclusive; -use index::{Point, Column, Side, Linear, Line}; +use index::{Point, Column, RangeInclusive, Side, Linear, Line}; use grid::ToRange; /// The area selected @@ -248,7 +247,7 @@ impl ToRange for Span { SpanType::ExcludeTail => (start, Span::exclude_end(end)) }; - start...end + RangeInclusive::new(start, end) } } -- cgit From 4e1f4c8cd7180606156b71ad0222f60e4559f2b3 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 6 Jan 2017 20:44:51 -0800 Subject: Clippy fixes! --- src/selection.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/selection.rs') diff --git a/src/selection.rs b/src/selection.rs index ff587b9d..3e5b799c 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -106,14 +106,14 @@ impl Selection { // Single-cell selections are a special case if start == end { - if start_side != end_side { + if start_side == end_side { + return None; + } else { return Some(Span { ty: SpanType::Inclusive, front: *front, tail: *tail }); - } else { - return None; } } -- cgit