aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_pty_proxy
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 01:36:41 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 01:36:41 +0200
commit47b76481e51451827530714512b30882d85e3a9a (patch)
tree3e64edfa304e11e4dff506683dd0a7ea7929123e /crates/turtle/src/atuin_pty_proxy
parentchore(treewide): Fix some of `clippy`'s error (diff)
downloadatuin-47b76481e51451827530714512b30882d85e3a9a.zip
chore(treewide): Also fix all `clippy` warnings
Diffstat (limited to 'crates/turtle/src/atuin_pty_proxy')
-rw-r--r--crates/turtle/src/atuin_pty_proxy/capture.rs1
-rw-r--r--crates/turtle/src/atuin_pty_proxy/debug.rs4
-rw-r--r--crates/turtle/src/atuin_pty_proxy/pty_proxy.rs8
-rw-r--r--crates/turtle/src/atuin_pty_proxy/screen.rs12
4 files changed, 12 insertions, 13 deletions
diff --git a/crates/turtle/src/atuin_pty_proxy/capture.rs b/crates/turtle/src/atuin_pty_proxy/capture.rs
index dbcb81fb..efba3c0b 100644
--- a/crates/turtle/src/atuin_pty_proxy/capture.rs
+++ b/crates/turtle/src/atuin_pty_proxy/capture.rs
@@ -187,6 +187,7 @@ fn normalize_screen_contents(contents: &str) -> String {
lines.join("\n")
}
+#[expect(clippy::naive_bytecount, reason = "This is just an estimation")]
fn estimated_rows(bytes: &[u8], cols: u16) -> u16 {
let newline_rows = bytes.iter().filter(|byte| **byte == b'\n').count() + 1;
let wrapped_rows = bytes.len() / cols as usize;
diff --git a/crates/turtle/src/atuin_pty_proxy/debug.rs b/crates/turtle/src/atuin_pty_proxy/debug.rs
index bf311281..c2a1691c 100644
--- a/crates/turtle/src/atuin_pty_proxy/debug.rs
+++ b/crates/turtle/src/atuin_pty_proxy/debug.rs
@@ -31,7 +31,7 @@ impl Osc133DebugHighlighter {
rendered.extend_from_slice(&data[start..offset]);
}
- rendered.extend_from_slice(event_label(&located.event));
+ rendered.extend_from_slice(event_label(located.event));
rendered.extend_from_slice(RESET);
start = offset;
}
@@ -41,7 +41,7 @@ impl Osc133DebugHighlighter {
}
}
-fn event_label(event: &Event) -> &'static [u8] {
+fn event_label(event: Event) -> &'static [u8] {
match event {
Event::PromptStart => b"\x1b[1;37;45m[OSC133:A prompt]\x1b[0m",
Event::CommandStart => b"\x1b[1;30;43m[OSC133:B input]\x1b[0m",
diff --git a/crates/turtle/src/atuin_pty_proxy/pty_proxy.rs b/crates/turtle/src/atuin_pty_proxy/pty_proxy.rs
index 70a53318..ef4b0c37 100644
--- a/crates/turtle/src/atuin_pty_proxy/pty_proxy.rs
+++ b/crates/turtle/src/atuin_pty_proxy/pty_proxy.rs
@@ -27,14 +27,16 @@ pub(crate) struct Init {
#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
#[value(rename_all = "lower")]
-#[expect(clippy::enum_variant_names, clippy::doc_markdown)]
enum Shell {
/// Zsh setup
Zsh,
+
/// Bash setup
Bash,
+
/// Fish setup
Fish,
+
/// Nu setup
Nu,
}
@@ -126,6 +128,10 @@ fn env_flag(name: &str) -> bool {
})
}
+#[expect(
+ clippy::literal_string_with_formatting_args,
+ reason = "It's shell code"
+)]
fn render_init(shell: Shell) -> &'static str {
match shell {
Shell::Bash | Shell::Zsh => {
diff --git a/crates/turtle/src/atuin_pty_proxy/screen.rs b/crates/turtle/src/atuin_pty_proxy/screen.rs
index c51a0c7d..58ebd2eb 100644
--- a/crates/turtle/src/atuin_pty_proxy/screen.rs
+++ b/crates/turtle/src/atuin_pty_proxy/screen.rs
@@ -18,12 +18,7 @@ pub(crate) fn spawn_parser_thread(rows: u16, cols: u16, msg_rx: Receiver<Msg>) {
std::thread::spawn(move || {
let mut parser = vt100::Parser::new(rows, cols, 0);
- loop {
- let first = match msg_rx.recv() {
- Ok(msg) => msg,
- Err(_) => break,
- };
-
+ while let Ok(first) = msg_rx.recv() {
handle_parser_msg(&mut parser, first);
while let Ok(msg) = msg_rx.try_recv() {
@@ -44,10 +39,7 @@ pub(crate) fn spawn_socket_server(sock_path: PathBuf, screen_tx: SyncSender<Msg>
};
for stream in listener.incoming() {
- let mut stream = match stream {
- Ok(s) => s,
- Err(_) => break,
- };
+ let Ok(mut stream) = stream else { break };
let (reply_tx, reply_rx) = mpsc::channel();
if screen_tx.send(Msg::ScreenRequest(reply_tx)).is_err() {