From 42489d39e18f6676b64de65eef98c2356125f72d Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 5 Mar 2020 13:07:14 -0800 Subject: [PATCH] Fix a few compile warnings --- src/bw_admin.rs | 2 +- src/main.rs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/bw_admin.rs b/src/bw_admin.rs index 6464280..e168a65 100644 --- a/src/bw_admin.rs +++ b/src/bw_admin.rs @@ -150,7 +150,7 @@ impl Client { } /// Get all existing users - pub fn users(&mut self) -> Result, Box> { + pub fn users(&mut self) -> Result, Box> { let all_users: Vec = self.get("/users").json()?; Ok(all_users) } diff --git a/src/main.rs b/src/main.rs index 387417a..b87dc2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ fn invite_users( config: &config::Config, client: &mut bw_admin::Client, start_loop: bool, -) -> Result<(), Box> { +) -> Result<(), Box> { if start_loop { start_sync_loop(config, client)?; } else { @@ -38,7 +38,7 @@ fn invite_users( } /// Creates set of email addresses for users that already exist in Bitwarden -fn get_existing_users(client: &mut bw_admin::Client) -> Result, Box> { +fn get_existing_users(client: &mut bw_admin::Client) -> Result, Box> { let all_users = client.users()?; let mut user_emails = HashSet::with_capacity(all_users.len()); for user in all_users { @@ -60,7 +60,11 @@ fn get_existing_users(client: &mut bw_admin::Client) -> Result, } /// Creates an LDAP connection, authenticating if necessary -fn ldap_client(ldap_url: String, bind_dn: String, bind_pw: String) -> Result> { +fn ldap_client( + ldap_url: String, + bind_dn: String, + bind_pw: String, +) -> Result> { let ldap = LdapConn::new(ldap_url.as_str())?; match ldap.simple_bind(bind_dn.as_str(), bind_pw.as_str()) { _ => {} @@ -70,7 +74,7 @@ fn ldap_client(ldap_url: String, bind_dn: String, bind_pw: String) -> Result Result, Box> { +fn search_entries(config: &config::Config) -> Result, Box> { let ldap = ldap_client( config.get_ldap_url(), config.get_ldap_bind_dn(), @@ -108,7 +112,7 @@ fn search_entries(config: &config::Config) -> Result, Box Result<(), Box> { +) -> Result<(), Box> { match get_existing_users(client) { Ok(existing_users) => { let mail_field = config.get_ldap_mail_field(); @@ -150,7 +154,7 @@ fn invite_from_ldap( fn start_sync_loop( config: &config::Config, client: &mut bw_admin::Client, -) -> Result<(), Box> { +) -> Result<(), Box> { let interval = Duration::from_secs(config.get_ldap_sync_interval_seconds()); loop { invite_from_ldap(config, client)?;