fmt: fmt and clippy

This commit is contained in:
silver 2023-05-26 00:51:36 +01:00
parent 1cdc732885
commit 311029574f
2 changed files with 24 additions and 22 deletions

View file

@ -1,18 +1,17 @@
use std::collections::HashSet;
use ldap3::result::Result;
use ldap3::{LdapConn, Scope, SearchEntry, Mod};
use base64::{Engine as _, engine::general_purpose}; use ldap3::{LdapConn, Mod, Scope, SearchEntry};
use crypto::{sha2::Sha512, digest::Digest}; use std::collections::HashSet;
use base64::{engine::general_purpose, Engine as _};
use crypto::{digest::Digest, sha2::Sha512};
// for teh webserver // for teh webserver
use dotenv::dotenv;
use skynet_ldap_server::db_init;
use sqlx::{Pool, Sqlite}; use sqlx::{Pool, Sqlite};
use std::env; use std::env;
use dotenv::dotenv;
use tide::prelude::*; use tide::prelude::*;
use tide::{Request, Response}; use tide::{Request, Response};
use skynet_ldap_server::db_init;
#[derive(Clone)] #[derive(Clone)]
struct State { struct State {
@ -42,7 +41,6 @@ async fn main() -> tide::Result<()> {
Ok(()) Ok(())
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct Config { struct Config {
ldap_host: String, ldap_host: String,
@ -82,21 +80,25 @@ pub fn hex_to_base64(hex: &str) -> String {
Ok(v) => bytes.push(v), Ok(v) => bytes.push(v),
Err(e) => println!("Problem with hex: {}", e), Err(e) => println!("Problem with hex: {}", e),
}; };
}; }
general_purpose::STANDARD.encode(&bytes) // now convert from Vec<u8> to b64-encoded String general_purpose::STANDARD.encode(&bytes) // now convert from Vec<u8> to b64-encoded String
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct LdapUpdate { struct LdapUpdate {
user: String, user: String,
pass: String, pass: String,
field: String, field: String,
value: String value: String,
} }
async fn post_update_ldap(mut req: Request<State>) -> tide::Result { async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
let LdapUpdate { user, pass, field, value } = req.body_json().await?; let LdapUpdate {
user,
pass,
field,
value,
} = req.body_json().await?;
let config = &req.state().config; let config = &req.state().config;