Fix clippy warning

This commit is contained in:
notplants 2021-12-22 14:47:41 -05:00
parent 5b72de0b2b
commit 4701c72f6a
1 changed files with 11 additions and 12 deletions

View File

@ -39,19 +39,18 @@ impl Sbot {
/// for the sbot, then retrieve the public key, private key (secret) and identity from the /// 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. /// `.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<String>, net_id: Option<String>) -> Result<Sbot, GolgiError> { pub async fn init(ip_port: Option<String>, net_id: Option<String>) -> Result<Sbot, GolgiError> {
let address;
if ip_port.is_none() {
address = "127.0.0.1:8008".to_string();
} else {
address = ip_port.unwrap();
}
let network_id; let address = if ip_port.is_none() {
if net_id.is_none() { "127.0.0.1:8008".to_string()
network_id = discovery::ssb_net_id();
} else { } 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() let OwnedIdentity { pk, sk, id } = keystore::from_gosbot_local()
.await .await
@ -113,7 +112,7 @@ impl Sbot {
utils::get_async(&mut self.rpc_reader, req_id, utils::publish_res_parse).await 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 /// # Arguments
/// ///