From 4701c72f6a2ca11e603a24e2e56ddf189589747d Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 22 Dec 2021 14:47:41 -0500 Subject: [PATCH] Fix clippy warning --- src/sbot.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/sbot.rs b/src/sbot.rs index 557faed..aaf4788 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -39,19 +39,18 @@ impl Sbot { /// for the sbot, then retrieve the public key, private key (secret) and identity from the /// `.ssb-go/secret` file. Open a TCP stream to the sbot and perform the secret handshake. If successful, create a box stream and split it into a writer and reader. Return RPC handles to the sbot as part of the `struct` output. pub async fn init(ip_port: Option, net_id: Option) -> Result { - let address; - if ip_port.is_none() { - address = "127.0.0.1:8008".to_string(); - } else { - address = ip_port.unwrap(); - } - let network_id; - if net_id.is_none() { - network_id = discovery::ssb_net_id(); + let address = if ip_port.is_none() { + "127.0.0.1:8008".to_string() } else { - network_id = auth::Key::from_slice(&hex::decode(net_id.unwrap()).unwrap()).unwrap(); - } + ip_port.unwrap() + }; + + let network_id = if net_id.is_none() { + discovery::ssb_net_id() + } else { + auth::Key::from_slice(&hex::decode(net_id.unwrap()).unwrap()).unwrap() + }; let OwnedIdentity { pk, sk, id } = keystore::from_gosbot_local() .await @@ -113,7 +112,7 @@ impl Sbot { utils::get_async(&mut self.rpc_reader, req_id, utils::publish_res_parse).await } - /// Wrapper for publish which constructs and publish a post message appropriately from a string. + /// Wrapper for publish which constructs and publishes a post message appropriately from a string. /// /// # Arguments ///