aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-23 16:34:43 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-23 16:34:43 -0400
commit212dee509296b7770c2994764841b77d44d86baa (patch)
tree598e47d9aeb346b7b06380236a7cba183f77c326 /src
parent80acb66445a612798ddf74bd6df60b51fd674fa0 (diff)
downloadrbw-212dee509296b7770c2994764841b77d44d86baa.tar.gz
rbw-212dee509296b7770c2994764841b77d44d86baa.zip
clean up some redundant parts of error messages
Diffstat (limited to 'src')
-rw-r--r--src/bin/rbw/actions.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/bin/rbw/actions.rs b/src/bin/rbw/actions.rs
index 01f448f..caeb636 100644
--- a/src/bin/rbw/actions.rs
+++ b/src/bin/rbw/actions.rs
@@ -2,19 +2,19 @@ use anyhow::Context as _;
use std::io::Read as _;
pub fn login() -> anyhow::Result<()> {
- simple_action(rbw::protocol::Action::Login, "login")
+ simple_action(rbw::protocol::Action::Login)
}
pub fn unlock() -> anyhow::Result<()> {
- simple_action(rbw::protocol::Action::Unlock, "unlock")
+ simple_action(rbw::protocol::Action::Unlock)
}
pub fn sync() -> anyhow::Result<()> {
- simple_action(rbw::protocol::Action::Sync, "sync")
+ simple_action(rbw::protocol::Action::Sync)
}
pub fn lock() -> anyhow::Result<()> {
- simple_action(rbw::protocol::Action::Lock, "lock")
+ simple_action(rbw::protocol::Action::Lock)
}
pub fn quit() -> anyhow::Result<()> {
@@ -107,10 +107,7 @@ pub fn version() -> anyhow::Result<u32> {
}
}
-fn simple_action(
- action: rbw::protocol::Action,
- desc: &str,
-) -> anyhow::Result<()> {
+fn simple_action(action: rbw::protocol::Action) -> anyhow::Result<()> {
let mut sock = crate::sock::Sock::connect()
.context("failed to connect to rbw-agent")?;
@@ -123,7 +120,7 @@ fn simple_action(
match res {
rbw::protocol::Response::Ack => Ok(()),
rbw::protocol::Response::Error { error } => {
- Err(anyhow::anyhow!("failed to {}: {}", desc, error))
+ Err(anyhow::anyhow!("{}", error))
}
_ => Err(anyhow::anyhow!("unexpected message: {:?}", res)),
}