summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-04-04 14:02:45 -0500
committerToby Vincent <tobyv13@gmail.com>2023-04-04 14:03:42 -0500
commit69733a88613394715b6409a98bca34d41e7dba70 (patch)
tree10c279276bb7d96c1eab9b4d0348e56a16190e21
parent10a035834bbb6abc7fe663d0345498720f5d625b (diff)
refactor: clean up tmux error handling and remove unused module
-rw-r--r--src/history/error.rs14
-rw-r--r--src/tmux.rs16
2 files changed, 5 insertions, 25 deletions
diff --git a/src/history/error.rs b/src/history/error.rs
deleted file mode 100644
index 8bdd2d6..0000000
--- a/src/history/error.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#[derive(Debug, thiserror::Error)]
-pub enum Error {
- #[error("IO error: {0}")]
- IO(#[from] std::io::Error),
-
- #[error(transparent)]
- Serialize(#[from] ron::Error),
-
- #[error(transparent)]
- Format(#[from] ron::de::SpannedError),
-
- #[error(transparent)]
- Tmux(#[from] crate::tmux::Error),
-}
diff --git a/src/tmux.rs b/src/tmux.rs
index e1fa3a6..e3efbd5 100644
--- a/src/tmux.rs
+++ b/src/tmux.rs
@@ -28,18 +28,11 @@ impl Tmux {
.output()?
.stdout;
- let sessions: Vec<Session> = std::str::from_utf8(&stdout)?
+ std::str::from_utf8(&stdout)?
.lines()
- .filter_map(|s| match ron::from_str(s) {
- Ok(session) => Some(session),
- Err(err) => {
- tracing::warn!(%err, "Invalid session format");
- None
- }
- })
- .collect();
-
- Ok(sessions)
+ .map(ron::from_str)
+ .collect::<Result<_, _>>()
+ .map_err(Into::into)
}
}
@@ -50,6 +43,7 @@ mod tests {
const SOCKET: &str = "test";
#[test]
+ #[ignore]
fn test_tmux_list() -> Result<(), Error> {
let names = Vec::from(["test_1", "test_2", "test_3", "test_4"]);