From 21d0c4b6ab3a23ffa6b381fc31ace567d7aa8801 Mon Sep 17 00:00:00 2001 From: glyph Date: Tue, 23 Aug 2022 08:35:20 +0100 Subject: [PATCH] no need to call functions using module prefix --- src/sbot.rs | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/sbot.rs b/src/sbot.rs index aed09fd..214a361 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -13,26 +13,24 @@ use golgi::{ use log::{debug, info, warn}; use serde_json::value::Value; -use crate::{db::Post, sbot}; +use crate::db::Post; /// Check the follow status of a remote peer and follow them if not already /// following. pub async fn follow_if_not_following(remote_peer: &str) -> Result<(), String> { - if let Ok(whoami) = sbot::whoami().await { - match sbot::is_following(&whoami, remote_peer).await { - Ok(status) if status.as_str() == "false" => { - match sbot::follow_peer(remote_peer).await { - Ok(_) => { - info!("Followed peer {}", &remote_peer); - Ok(()) - } - Err(e) => { - let err_msg = format!("Failed to follow peer {}: {}", &remote_peer, e); - warn!("{}", err_msg); - Err(err_msg) - } + if let Ok(whoami) = whoami().await { + match is_following(&whoami, remote_peer).await { + Ok(status) if status.as_str() == "false" => match follow_peer(remote_peer).await { + Ok(_) => { + info!("Followed peer {}", &remote_peer); + Ok(()) } - } + Err(e) => { + let err_msg = format!("Failed to follow peer {}: {}", &remote_peer, e); + warn!("{}", err_msg); + Err(err_msg) + } + }, Ok(status) if status.as_str() == "true" => { info!( "Already following peer {}. No further action taken", @@ -55,11 +53,11 @@ pub async fn follow_if_not_following(remote_peer: &str) -> Result<(), String> { /// Check the follow status of a remote peer and unfollow them if already /// following. pub async fn unfollow_if_following(remote_peer: &str) -> Result<(), String> { - if let Ok(whoami) = sbot::whoami().await { - match sbot::is_following(&whoami, remote_peer).await { + if let Ok(whoami) = whoami().await { + match is_following(&whoami, remote_peer).await { Ok(status) if status.as_str() == "true" => { info!("Unfollowing peer {}", &remote_peer); - match sbot::unfollow_peer(remote_peer).await { + match unfollow_peer(remote_peer).await { Ok(_) => { info!("Unfollowed peer {}", &remote_peer); Ok(())