Clippy
This commit is contained in:
parent
e32f27494a
commit
cc004df6e8
3 changed files with 8 additions and 10 deletions
|
|
@ -476,15 +476,14 @@ impl UI {
|
||||||
ev: Option<Result<Event, std::io::Error>>,
|
ev: Option<Result<Event, std::io::Error>>,
|
||||||
) {
|
) {
|
||||||
match ev {
|
match ev {
|
||||||
Some(Ok(Event::Key(ev))) => match ev {
|
Some(Ok(Event::Key(
|
||||||
KeyEvent { code: KeyCode::Esc, .. }
|
KeyEvent { code: KeyCode::Esc, .. }
|
||||||
| KeyEvent { code: KeyCode::Char('q'), .. }
|
| KeyEvent { code: KeyCode::Char('q'), .. }
|
||||||
| KeyEvent { code: KeyCode::Char('?'), .. }
|
| KeyEvent { code: KeyCode::Char('?'), .. }
|
||||||
| KeyEvent { code: KeyCode::Char('h'), .. } => {
|
| KeyEvent { code: KeyCode::Char('h'), .. },
|
||||||
|
))) => {
|
||||||
self.show_help = false;
|
self.show_help = false;
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
},
|
|
||||||
Some(Ok(_)) => (), // Don't care about this event...
|
Some(Ok(_)) => (), // Don't care about this event...
|
||||||
Some(Err(_)) => (), // Hmmmmmm.....?
|
Some(Err(_)) => (), // Hmmmmmm.....?
|
||||||
None => (), // ....no events? what?
|
None => (), // ....no events? what?
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,7 @@ impl Message {
|
||||||
result.put_u16(port.port);
|
result.put_u16(port.port);
|
||||||
|
|
||||||
// Port descriptions can be long, let's make sure they're not.
|
// Port descriptions can be long, let's make sure they're not.
|
||||||
let sliced =
|
let sliced = slice_up_to(&port.desc, u16::MAX.into());
|
||||||
slice_up_to(&port.desc, u16::max_value().into());
|
|
||||||
put_string(result, sliced);
|
put_string(result, sliced);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ mod tests {
|
||||||
use tokio::io::{AsyncReadExt, DuplexStream};
|
use tokio::io::{AsyncReadExt, DuplexStream};
|
||||||
|
|
||||||
async fn sync(client_read: &mut DuplexStream) {
|
async fn sync(client_read: &mut DuplexStream) {
|
||||||
print!("[client] Waiting for server sync...\n");
|
println!("[client] Waiting for server sync...");
|
||||||
for _ in 0..8 {
|
for _ in 0..8 {
|
||||||
let b = client_read
|
let b = client_read
|
||||||
.read_u8()
|
.read_u8()
|
||||||
|
|
@ -124,7 +124,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut reader = MessageReader::new(client_read);
|
let mut reader = MessageReader::new(client_read);
|
||||||
print!("[client] Reading first message...\n");
|
println!("[client] Reading first message...");
|
||||||
let msg = reader.read().await.expect("Error reading first message");
|
let msg = reader.read().await.expect("Error reading first message");
|
||||||
assert_matches!(msg, Message::Hello(0, 2, _));
|
assert_matches!(msg, Message::Hello(0, 2, _));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue