aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/input.rs b/src/input.rs
index 7afd359d..aa00ee3d 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -102,15 +102,15 @@ impl<T: Eq> Binding<T> {
fn is_triggered_by(
&self,
mode: TermMode,
- mods: &ModifiersState,
+ mods: ModifiersState,
input: &T
) -> bool {
// Check input first since bindings are stored in one big list. This is
// the most likely item to fail so prioritizing it here allows more
// checks to be short circuited.
self.trigger == *input &&
- self.mode_matches(&mode) &&
- self.not_mode_matches(&mode) &&
+ self.mode_matches(mode) &&
+ self.not_mode_matches(mode) &&
self.mods_match(mods)
}
}
@@ -123,12 +123,12 @@ impl<T> Binding<T> {
}
#[inline]
- fn mode_matches(&self, mode: &TermMode) -> bool {
+ fn mode_matches(&self, mode: TermMode) -> bool {
self.mode.is_empty() || mode.intersects(self.mode)
}
#[inline]
- fn not_mode_matches(&self, mode: &TermMode) -> bool {
+ fn not_mode_matches(&self, mode: TermMode) -> bool {
self.notmode.is_empty() || !mode.intersects(self.notmode)
}
@@ -136,10 +136,10 @@ impl<T> Binding<T> {
///
/// Optimized to use single check instead of four (one per modifier)
#[inline]
- fn mods_match(&self, mods: &ModifiersState) -> bool {
+ fn mods_match(&self, mods: ModifiersState) -> bool {
debug_assert!(4 == mem::size_of::<ModifiersState>());
unsafe {
- mem::transmute_copy::<_, u32>(&self.mods) == mem::transmute_copy::<_, u32>(mods)
+ mem::transmute_copy::<_, u32>(&self.mods) == mem::transmute_copy::<_, u32>(&mods)
}
}
}
@@ -532,7 +532,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
return;
}
- self.process_mouse_bindings(&ModifiersState::default(), button);
+ self.process_mouse_bindings(ModifiersState::default(), button);
}
/// Process key input
@@ -542,11 +542,11 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
&mut self,
state: ElementState,
key: Option<VirtualKeyCode>,
- mods: &ModifiersState,
+ mods: ModifiersState,
) {
match (key, state) {
(Some(key), ElementState::Pressed) => {
- *self.ctx.last_modifiers() = *mods;
+ *self.ctx.last_modifiers() = mods;
*self.ctx.received_count() = 0;
*self.ctx.suppress_chars() = false;
@@ -587,7 +587,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// for its action to be executed.
///
/// Returns true if an action is executed.
- fn process_key_bindings(&mut self, mods: &ModifiersState, key: VirtualKeyCode) -> bool {
+ fn process_key_bindings(&mut self, mods: ModifiersState, key: VirtualKeyCode) -> bool {
for binding in self.key_bindings {
if binding.is_triggered_by(self.ctx.terminal_mode(), mods, &key) {
// binding was triggered; run the action
@@ -605,7 +605,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// for its action to be executed.
///
/// Returns true if an action is executed.
- fn process_mouse_bindings(&mut self, mods: &ModifiersState, button: MouseButton) -> bool {
+ fn process_mouse_bindings(&mut self, mods: ModifiersState, button: MouseButton) -> bool {
for binding in self.mouse_bindings {
if binding.is_triggered_by(self.ctx.terminal_mode(), mods, &button) {
// binding was triggered; run the action
@@ -782,9 +782,9 @@ mod tests {
#[test]
fn $name() {
if $triggers {
- assert!($binding.is_triggered_by($mode, &$mods, &KEY));
+ assert!($binding.is_triggered_by($mode, $mods, &KEY));
} else {
- assert!(!$binding.is_triggered_by($mode, &$mods, &KEY));
+ assert!(!$binding.is_triggered_by($mode, $mods, &KEY));
}
}
}