aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-04 20:26:53 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-04 20:26:53 -0500
commitadd8d2d0de591a055e9c7b3d5c557cb72f961c39 (patch)
tree460f24fa35ecb6325434cfaf2db9d2e130ae64b0
parentde4c2b1de367aa2b6d20ec0c90f317e19d245ae9 (diff)
downloadttyrec-bin-add8d2d0de591a055e9c7b3d5c557cb72f961c39.tar.gz
ttyrec-bin-add8d2d0de591a055e9c7b3d5c557cb72f961c39.zip
clippy
-rw-r--r--src/bin/ttyplay/display.rs2
-rw-r--r--src/bin/ttyplay/frames.rs2
-rw-r--r--src/bin/ttyplay/input.rs2
-rw-r--r--src/bin/ttyplay/main.rs17
-rw-r--r--src/bin/ttyrec/main.rs10
5 files changed, 18 insertions, 15 deletions
diff --git a/src/bin/ttyplay/display.rs b/src/bin/ttyplay/display.rs
index b1836d8..38e3bf3 100644
--- a/src/bin/ttyplay/display.rs
+++ b/src/bin/ttyplay/display.rs
@@ -77,7 +77,7 @@ impl Display {
output.reset_attributes();
output.set_fgcolor(textmode::color::BLACK);
output.set_bgcolor(textmode::color::RED);
- output.write_str("⏸");
+ output.write_str("\u{23f8}");
output.reset_attributes();
output.move_to(pos.0, pos.1);
diff --git a/src/bin/ttyplay/frames.rs b/src/bin/ttyplay/frames.rs
index 2f0b1a7..abd3a38 100644
--- a/src/bin/ttyplay/frames.rs
+++ b/src/bin/ttyplay/frames.rs
@@ -49,7 +49,7 @@ impl FrameData {
self.new_frame_w
.send(Some(self.frames.len()))
.await
- .unwrap()
+ .unwrap();
}
pub async fn done_reading(&mut self) {
diff --git a/src/bin/ttyplay/input.rs b/src/bin/ttyplay/input.rs
index d7cdc57..31770fd 100644
--- a/src/bin/ttyplay/input.rs
+++ b/src/bin/ttyplay/input.rs
@@ -1,4 +1,4 @@
-pub async fn handle_input(
+pub async fn handle(
key: textmode::Key,
event_w: async_std::channel::Sender<crate::event::Event>,
) -> anyhow::Result<()> {
diff --git a/src/bin/ttyplay/main.rs b/src/bin/ttyplay/main.rs
index a98f5f9..01eecbc 100644
--- a/src/bin/ttyplay/main.rs
+++ b/src/bin/ttyplay/main.rs
@@ -1,3 +1,7 @@
+#![warn(clippy::pedantic)]
+#![warn(clippy::nursery)]
+#![allow(clippy::missing_const_for_fn)]
+
use async_std::prelude::FutureExt as _;
mod display;
@@ -31,11 +35,10 @@ fn spawn_frame_reader_task(
);
let mut parser = vt100::Parser::new(size.0, size.1, 0);
while let Ok(frame) = reader.read_frame().await {
- let delay = if let Some(time) = reader.offset() {
- frame.time - time
- } else {
- std::time::Duration::from_secs(0)
- };
+ let delay = reader.offset().map_or_else(
+ || std::time::Duration::from_secs(0),
+ |time| frame.time - time,
+ );
parser.process(&frame.data);
let mut frames = frames.lock_arc().await;
frames
@@ -77,7 +80,7 @@ fn spawn_timer_task(
let now = std::time::Instant::now();
start_time = now - frame.delay();
if paused_time.take().is_some() {
- paused_time = Some(now)
+ paused_time = Some(now);
}
force_update_time = false;
} else if paused_time.is_some() {
@@ -176,7 +179,7 @@ async fn async_main(opt: Opt) -> anyhow::Result<()> {
display.render(&screen, &mut output).await?;
}
event::Event::Key(key) => {
- input::handle_input(key, event_w.clone()).await?
+ input::handle(key, event_w.clone()).await?;
}
event::Event::FrameLoaded(n) => {
if let Some(n) = n {
diff --git a/src/bin/ttyrec/main.rs b/src/bin/ttyrec/main.rs
index c594c87..a6ccdf4 100644
--- a/src/bin/ttyrec/main.rs
+++ b/src/bin/ttyrec/main.rs
@@ -1,3 +1,7 @@
+#![warn(clippy::pedantic)]
+#![warn(clippy::nursery)]
+#![allow(clippy::too_many_lines)]
+
use async_std::io::{ReadExt as _, WriteExt as _};
use async_std::prelude::FutureExt as _;
use async_std::stream::StreamExt as _;
@@ -146,12 +150,8 @@ async fn async_main(opt: Opt) -> anyhow::Result<()> {
Err(e) => {
if e.raw_os_error() == Some(libc::EIO) {
break;
- } else {
- anyhow::bail!(
- "failed to read from child process: {}",
- e
- );
}
+ anyhow::bail!("failed to read from child process: {}", e);
}
},
Event::Resize((h, w)) => {