remove unused 'self' (clippy::unused_self)
This commit is contained in:
parent
1b53309d63
commit
5f0a0ba726
2 changed files with 8 additions and 12 deletions
|
|
@ -15,7 +15,7 @@ pub struct MouseReporter {
|
|||
}
|
||||
|
||||
impl MouseReporter {
|
||||
fn button_number(&self, button: Button) -> Option<u8> {
|
||||
fn button_number(button: Button) -> Option<u8> {
|
||||
match button {
|
||||
Button::Left => Some(0),
|
||||
Button::Middle => Some(1),
|
||||
|
|
@ -39,7 +39,7 @@ impl MouseReporter {
|
|||
let mut button = (match event {
|
||||
Event::Mouse(MouseEvent::ButtonPressed(b)) => {
|
||||
self.button = Some(b);
|
||||
self.button_number(b)
|
||||
Self::button_number(b)
|
||||
}
|
||||
Event::Mouse(MouseEvent::ButtonReleased(_b)) => {
|
||||
self.button = None;
|
||||
|
|
@ -59,9 +59,7 @@ impl MouseReporter {
|
|||
//character, Cb).
|
||||
//For example, motion into cell x,y with button 1 down is reported as
|
||||
//CSI M @ CxCy ( @ = 32 + 0 (button 1) + 32 (motion indicator) ).
|
||||
self.button
|
||||
.and_then(|button| self.button_number(button))
|
||||
.map(|b| b + 32)
|
||||
self.button.and_then(Self::button_number).map(|b| b + 32)
|
||||
}
|
||||
_ => None,
|
||||
})?;
|
||||
|
|
@ -129,12 +127,12 @@ impl MouseReporter {
|
|||
Event::Mouse(MouseEvent::ButtonPressed(button)) => {
|
||||
//Button pressed is reported as button 0,1,2 and event code M
|
||||
self.button = Some(button);
|
||||
Some((self.button_number(button), "M"))
|
||||
Some((Self::button_number(button), "M"))
|
||||
}
|
||||
Event::Mouse(MouseEvent::ButtonReleased(button)) => {
|
||||
//Button pressed is reported as button 0,1,2 and event code m
|
||||
self.button = None;
|
||||
Some((self.button_number(button), "m"))
|
||||
Some((Self::button_number(button), "m"))
|
||||
}
|
||||
Event::Mouse(MouseEvent::CursorMoved { .. }) => {
|
||||
//Button pressed is reported as button 32 + 0,1,2 and event code M
|
||||
|
|
@ -146,7 +144,7 @@ impl MouseReporter {
|
|||
self.last_movment_y = Some(y);
|
||||
}
|
||||
self.button
|
||||
.map(|button| (self.button_number(button).map(|b| b + 32), "M"))
|
||||
.map(|button| (Self::button_number(button).map(|b| b + 32), "M"))
|
||||
}
|
||||
_ => None,
|
||||
})?;
|
||||
|
|
@ -170,7 +168,6 @@ impl MouseReporter {
|
|||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn report_sgr_mouse_wheel_scroll(
|
||||
&self,
|
||||
terminal: &Terminal,
|
||||
term_cell_width: f32,
|
||||
term_cell_height: f32,
|
||||
|
|
@ -213,7 +210,6 @@ impl MouseReporter {
|
|||
//Emulate mouse wheel scroll with up/down arrows. Using mouse spec uses
|
||||
//scroll-back and scroll-forw actions, which moves whole windows like page up/page down.
|
||||
pub fn report_mouse_wheel_as_arrows(
|
||||
&self,
|
||||
terminal: &Terminal,
|
||||
term_cell_width: f32,
|
||||
term_cell_height: f32,
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@ impl Terminal {
|
|||
let term_lock = self.term.lock();
|
||||
let mode = term_lock.mode();
|
||||
if mode.contains(TermMode::SGR_MOUSE) {
|
||||
self.mouse_reporter.report_sgr_mouse_wheel_scroll(
|
||||
MouseReporter::report_sgr_mouse_wheel_scroll(
|
||||
self,
|
||||
self.size().cell_width,
|
||||
self.size().cell_height,
|
||||
|
|
@ -865,7 +865,7 @@ impl Terminal {
|
|||
y,
|
||||
);
|
||||
} else {
|
||||
self.mouse_reporter.report_mouse_wheel_as_arrows(
|
||||
MouseReporter::report_mouse_wheel_as_arrows(
|
||||
self,
|
||||
self.size().cell_width,
|
||||
self.size().cell_height,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue