fixed a few clippy warnings (#44)
This commit is contained in:
parent
32d62043a7
commit
21716b2f93
13
src/event.rs
13
src/event.rs
|
@ -153,7 +153,7 @@ where I: Iterator<Item = Result<u8, Error>>
|
|||
c = iter.next().unwrap().unwrap();
|
||||
}
|
||||
let str_buf = String::from_utf8(buf).unwrap();
|
||||
let ref mut nums = str_buf.split(';');
|
||||
let nums = &mut str_buf.split(';');
|
||||
|
||||
let cb = nums.next().unwrap().parse::<u16>().unwrap();
|
||||
let cx = nums.next().unwrap().parse::<u16>().unwrap();
|
||||
|
@ -192,7 +192,7 @@ where I: Iterator<Item = Result<u8, Error>>
|
|||
// ESC [ Cb ; Cx ; Cy ; M
|
||||
b'M' => {
|
||||
let str_buf = String::from_utf8(buf).unwrap();
|
||||
let ref mut nums = str_buf.split(';');
|
||||
let nums = &mut str_buf.split(';');
|
||||
|
||||
let cb = nums.next().unwrap().parse::<u16>().unwrap();
|
||||
let cx = nums.next().unwrap().parse::<u16>().unwrap();
|
||||
|
@ -203,7 +203,7 @@ where I: Iterator<Item = Result<u8, Error>>
|
|||
33 => MouseEvent::Press(MouseButton::Middle, cx, cy),
|
||||
34 => MouseEvent::Press(MouseButton::Right, cx, cy),
|
||||
35 => MouseEvent::Release(cx, cy),
|
||||
96 => MouseEvent::Press(MouseButton::WheelUp, cx, cy),
|
||||
96 |
|
||||
97 => MouseEvent::Press(MouseButton::WheelUp, cx, cy),
|
||||
_ => return error,
|
||||
};
|
||||
|
@ -264,14 +264,13 @@ fn parse_utf8_char<I>(c: u8, iter: &mut I) -> Result<char, Error>
|
|||
if c.is_ascii() {
|
||||
Ok(c as char)
|
||||
} else {
|
||||
let ref mut bytes = Vec::new();
|
||||
let bytes = &mut Vec::new();
|
||||
bytes.push(c);
|
||||
|
||||
loop {
|
||||
bytes.push(iter.next().unwrap().unwrap());
|
||||
match str::from_utf8(bytes) {
|
||||
Ok(st) => return Ok(st.chars().next().unwrap()),
|
||||
Err(_) => {},
|
||||
if let Ok(st) = str::from_utf8(bytes) {
|
||||
return Ok(st.chars().next().unwrap())
|
||||
}
|
||||
if bytes.len() >= 4 { return error; }
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ impl<I: Iterator<Item = Result<u8, io::Error>>> Iterator for Events<I> {
|
|||
type Item = Result<Event, io::Error>;
|
||||
|
||||
fn next(&mut self) -> Option<Result<Event, io::Error>> {
|
||||
let ref mut iter = self.bytes;
|
||||
let iter = &mut self.bytes;
|
||||
match iter.next() {
|
||||
Some(item) => Some(parse_event(item, iter).or(Ok(Event::Unsupported))),
|
||||
None => None,
|
||||
|
|
|
@ -75,7 +75,7 @@ impl<W: Write> IntoRawMode for W {
|
|||
use termios::{cfmakeraw, get_terminal_attr, set_terminal_attr};
|
||||
|
||||
let (mut ios, exit) = get_terminal_attr();
|
||||
let prev_ios = ios.clone();
|
||||
let prev_ios = ios;
|
||||
if exit != 0 {
|
||||
return Err(io::Error::new(io::ErrorKind::Other, "Unable to get Termios attribute."));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue