1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-02-10 15:46:10 -05:00

Fix tests and clippy warnings

This commit is contained in:
Christian Duerr 2018-10-02 22:12:41 +02:00
parent 9d42de6c7c
commit 078f91b162
No known key found for this signature in database
GPG key ID: 85CDAE3C164BA7B4
2 changed files with 21 additions and 18 deletions

View file

@ -14,7 +14,7 @@
//! Tests for the Gird //! Tests for the Gird
use super::{Grid, BidirectionalIterator}; use super::{Grid};
use index::{Point, Line, Column}; use index::{Point, Line, Column};
// Scroll up moves lines upwards // Scroll up moves lines upwards
@ -112,7 +112,7 @@ fn test_iter() {
col: Column(0), col: Column(0),
}); });
assert_eq!(None, iter.prev()); assert_eq!(None, iter.next_back());
assert_eq!(Some(&1), iter.next()); assert_eq!(Some(&1), iter.next());
assert_eq!(Column(1), iter.cur.col); assert_eq!(Column(1), iter.cur.col);
assert_eq!(4, iter.cur.line); assert_eq!(4, iter.cur.line);
@ -126,7 +126,7 @@ fn test_iter() {
assert_eq!(Column(0), iter.cur.col); assert_eq!(Column(0), iter.cur.col);
assert_eq!(3, iter.cur.line); assert_eq!(3, iter.cur.line);
assert_eq!(Some(&4), iter.prev()); assert_eq!(Some(&4), iter.next_back());
assert_eq!(Column(4), iter.cur.col); assert_eq!(Column(4), iter.cur.col);
assert_eq!(4, iter.cur.line); assert_eq!(4, iter.cur.line);
@ -137,5 +137,5 @@ fn test_iter() {
col: Column(4), col: Column(4),
}); });
assert_eq!(None, final_iter.next()); assert_eq!(None, final_iter.next());
assert_eq!(Some(&23), final_iter.prev()); assert_eq!(Some(&23), final_iter.next_back());
} }

View file

@ -488,9 +488,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
} else { } else {
// Spawn URL launcher when clicking on URLs // Spawn URL launcher when clicking on URLs
let moved = self.ctx.mouse().last_press_pos != (self.ctx.mouse().x, self.ctx.mouse().y); let moved = self.ctx.mouse().last_press_pos != (self.ctx.mouse().x, self.ctx.mouse().y);
let ref url_launcher = self.mouse_config.url_launcher; if let (Some(point), Some(launcher), false) =
match (self.ctx.mouse_coords(), url_launcher, moved) { (self.ctx.mouse_coords(), &self.mouse_config.url_launcher, moved)
(Some(point), Some(launcher), false) => { {
if let Some(text) = self.ctx.url(Point::new(point.line.0, point.col)) { if let Some(text) = self.ctx.url(Point::new(point.line.0, point.col)) {
let mut args = launcher.args().to_vec(); let mut args = launcher.args().to_vec();
args.push(text); args.push(text);
@ -501,8 +501,6 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
.expect("url launcher error"); .expect("url launcher error");
} }
} }
_ => (),
}
} }
if self.save_to_clipboard { if self.save_to_clipboard {
@ -798,6 +796,10 @@ mod tests {
self.mouse self.mouse
} }
fn url(&self, _: Point<usize>) -> Option<String> {
None
}
fn received_count(&mut self) -> &mut usize { fn received_count(&mut self) -> &mut usize {
&mut self.received_count &mut self.received_count
} }
@ -866,11 +868,12 @@ mod tests {
threshold: Duration::from_millis(1000), threshold: Duration::from_millis(1000),
}, },
faux_scrollback_lines: None, faux_scrollback_lines: None,
url_launcher: None,
}, },
scrolling_config: &config::Scrolling::default(), scrolling_config: &config::Scrolling::default(),
key_bindings: &config.key_bindings()[..], key_bindings: &config.key_bindings()[..],
mouse_bindings: &config.mouse_bindings()[..], mouse_bindings: &config.mouse_bindings()[..],
save_to_clipboard: config.selection().save_to_clipboard save_to_clipboard: config.selection().save_to_clipboard,
}; };
if let Event::WindowEvent { event: WindowEvent::MouseInput { state, button, modifiers, .. }, .. } = $input { if let Event::WindowEvent { event: WindowEvent::MouseInput { state, button, modifiers, .. }, .. } = $input {