diff --git a/bffhd/actors/mod.rs b/bffhd/actors/mod.rs index 64e3607..791b882 100644 --- a/bffhd/actors/mod.rs +++ b/bffhd/actors/mod.rs @@ -3,20 +3,20 @@ use crate::resources::state::State; use crate::{Config, ResourcesHandle}; use async_compat::CompatExt; use executor::pool::Executor; -use futures_signals::signal::{MutableSignalRef, ReadOnlyMutable, Signal}; +use futures_signals::signal::{Signal}; use futures_util::future::BoxFuture; use rumqttc::{AsyncClient, ConnectionError, Event, Incoming, MqttOptions}; use std::cell::Cell; use std::collections::HashMap; use std::future::Future; -use std::ops::Deref; + use std::pin::Pin; -use std::sync::Mutex; + use std::task::{Context, Poll}; use std::time::Duration; -use anyhow::Context as _; + use once_cell::sync::Lazy; -use rustls::{Certificate, RootCertStore}; +use rustls::{RootCertStore}; use url::Url; use crate::actors::dummy::Dummy; use crate::actors::process::Process; diff --git a/bffhd/authentication.rs b/bffhd/authentication.rs index 1f2086a..531889c 100644 --- a/bffhd/authentication.rs +++ b/bffhd/authentication.rs @@ -1,11 +1,11 @@ -use crate::users::db::UserDB; + use crate::users::Users; -use rsasl::error::{SASLError, SessionError}; +use rsasl::error::{SessionError}; use rsasl::mechname::Mechname; use rsasl::property::{AuthId, Password}; use rsasl::session::{Session, SessionData}; use rsasl::validate::{validations, Validation}; -use rsasl::{Property, SASL}; +use rsasl::{SASL}; use std::sync::Arc; struct Callback { @@ -21,7 +21,7 @@ impl rsasl::callback::Callback for Callback { &self, session: &mut SessionData, validation: Validation, - mechanism: &Mechname, + _mechanism: &Mechname, ) -> Result<(), SessionError> { match validation { validations::SIMPLE => { @@ -38,7 +38,7 @@ impl rsasl::callback::Callback for Callback { if user .check_password(passwd.as_bytes()) - .map_err(|e| SessionError::AuthenticationFailure)? + .map_err(|_e| SessionError::AuthenticationFailure)? { Ok(()) } else { diff --git a/bffhd/authorization/mod.rs b/bffhd/authorization/mod.rs index 91bc1ae..7a41eb0 100644 --- a/bffhd/authorization/mod.rs +++ b/bffhd/authorization/mod.rs @@ -1,8 +1,8 @@ -use std::sync::Arc; -use crate::authorization::permissions::Permission; -use crate::authorization::roles::{Role, Roles}; + + +use crate::authorization::roles::{Roles}; use crate::Users; -use crate::users::UserRef; + pub mod permissions; pub mod roles; diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index a4ee83b..4a6c2d9 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -2,10 +2,10 @@ use capnp::capability::Promise; use capnp::Error; use capnp_rpc::pry; use rsasl::property::AuthId; -use rsasl::session::{Session, Step, StepResult}; +use rsasl::session::{Session, Step}; use std::io::Cursor; -use crate::authorization::AuthorizationHandle; + use crate::capnp::session::APISession; use crate::session::SessionManager; use api::authenticationsystem_capnp::authentication::{ diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index 718e24d..9902b56 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -53,7 +53,7 @@ impl bootstrap::Server for BootCap { fn mechanisms( &mut self, - params: bootstrap::MechanismsParams, + _params: bootstrap::MechanismsParams, mut result: bootstrap::MechanismsResults, ) -> Promise<(), ::capnp::Error> { let span = tracing::trace_span!("mechanisms", peer_addr=%self.peer_addr); @@ -61,7 +61,7 @@ impl bootstrap::Server for BootCap { tracing::trace!("mechanisms"); - let mut builder = result.get(); + let builder = result.get(); let mechs: Vec<_> = self.authentication.list_available_mechs() .into_iter() .map(|m| m.as_str()) diff --git a/bffhd/capnp/machine.rs b/bffhd/capnp/machine.rs index 3aed94a..4eb8573 100644 --- a/bffhd/capnp/machine.rs +++ b/bffhd/capnp/machine.rs @@ -1,4 +1,4 @@ -use crate::resources::modules::fabaccess::{MachineState, Status}; +use crate::resources::modules::fabaccess::{Status}; use crate::resources::Resource; use crate::session::SessionHandle; use api::machine_capnp::machine::{ @@ -17,7 +17,7 @@ pub struct Machine { impl Machine { /// Builds a machine into the given builder. Re - pub fn build(session: SessionHandle, resource: Resource, builder: Builder) { + pub fn build(session: SessionHandle, resource: Resource, _builder: Builder) { if resource.visible(&session) {} } } @@ -178,7 +178,7 @@ impl ManageServer for Machine { _: manage::ForceFreeResults, ) -> Promise<(), ::capnp::Error> { let resource = self.resource.clone(); - let session = self.session.clone(); + let _session = self.session.clone(); Promise::from_future(async move { resource.force_set(Status::Free).await; Ok(()) @@ -213,7 +213,7 @@ impl ManageServer for Machine { _: manage::DisabledParams, _: manage::DisabledResults, ) -> Promise<(), ::capnp::Error> { - let mut resource = self.resource.clone(); + let resource = self.resource.clone(); Promise::from_future(async move { resource.force_set(Status::Disabled).await; Ok(()) diff --git a/bffhd/capnp/machinesystem.rs b/bffhd/capnp/machinesystem.rs index e868b79..a666fd5 100644 --- a/bffhd/capnp/machinesystem.rs +++ b/bffhd/capnp/machinesystem.rs @@ -1,4 +1,4 @@ -use crate::authorization::AuthorizationHandle; + use crate::session::SessionHandle; use api::machinesystem_capnp::machine_system::{ info, InfoParams, InfoResults, Server as MachineSystem, @@ -45,7 +45,7 @@ impl info::Server for Machines { let mut builder = result.get().init_machine_list(machine_list.len() as u32); for (i, m) in machine_list { let resource = m.clone(); - let mut mbuilder = builder.reborrow().get(i as u32); + let mbuilder = builder.reborrow().get(i as u32); Machine::build(self.session.clone(), resource, mbuilder); } @@ -61,7 +61,7 @@ impl info::Server for Machines { let id = pry!(params.get_id()); if let Some(resource) = self.resources.get_by_id(id) { - let mut builder = result.get(); + let builder = result.get(); Machine::build(self.session.clone(), resource.clone(), builder); } @@ -77,7 +77,7 @@ impl info::Server for Machines { let urn = pry!(params.get_urn()); if let Some(resource) = self.resources.get_by_urn(urn) { - let mut builder = result.get(); + let builder = result.get(); Machine::build(self.session.clone(), resource.clone(), builder); } diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index f483b2f..92a04ca 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -1,9 +1,9 @@ use crate::config::Listen; -use crate::{Diflouroborane, TlsConfig}; -use anyhow::Context; + + use async_net::TcpListener; -use capnp::capability::Promise; -use capnp::Error; + + use capnp_rpc::rpc_twoparty_capnp::Side; use capnp_rpc::twoparty::VatNetwork; use capnp_rpc::RpcSystem; @@ -12,17 +12,17 @@ use futures_rustls::server::TlsStream; use futures_rustls::TlsAcceptor; use futures_util::stream::FuturesUnordered; use futures_util::{stream, AsyncRead, AsyncWrite, FutureExt, StreamExt}; -use std::fs::File; + use std::future::Future; use std::io; -use std::io::BufReader; -use std::net::SocketAddr; -use std::sync::Arc; -use nix::sys::socket::SockAddr; -use crate::authentication::AuthenticationHandle; -use crate::authorization::AuthorizationHandle; -use crate::error::Result; +use std::net::SocketAddr; + + +use crate::authentication::AuthenticationHandle; + + + use crate::session::SessionManager; mod authenticationsystem; @@ -69,7 +69,7 @@ impl APIServer { let span = tracing::info_span!("binding API listen sockets"); let _guard = span.enter(); - let mut sockets = FuturesUnordered::new(); + let sockets = FuturesUnordered::new(); listens .into_iter() diff --git a/bffhd/capnp/permissionsystem.rs b/bffhd/capnp/permissionsystem.rs index cf7f803..5a65448 100644 --- a/bffhd/capnp/permissionsystem.rs +++ b/bffhd/capnp/permissionsystem.rs @@ -1,11 +1,11 @@ use api::permissionsystem_capnp::permission_system::Server as PermissionSystem; -use crate::authorization::AuthorizationHandle; + use crate::session::SessionHandle; pub struct Permissions; impl Permissions { - pub fn new(session: SessionHandle) -> Self { + pub fn new(_session: SessionHandle) -> Self { Self } } diff --git a/bffhd/capnp/session.rs b/bffhd/capnp/session.rs index c02ec9e..7d2f1eb 100644 --- a/bffhd/capnp/session.rs +++ b/bffhd/capnp/session.rs @@ -1,11 +1,11 @@ use api::authenticationsystem_capnp::response::successful::Builder; -use capnp::capability::Promise; -use crate::authorization::AuthorizationHandle; + + use crate::capnp::machinesystem::Machines; use crate::capnp::permissionsystem::Permissions; use crate::capnp::user_system::Users; -use crate::session::{SessionHandle, SessionManager}; -use crate::users::UserRef; +use crate::session::{SessionHandle}; + #[derive(Debug, Clone)] pub struct APISession; @@ -15,7 +15,7 @@ impl APISession { Self } - pub fn build(session: SessionHandle, mut builder: Builder) { + pub fn build(session: SessionHandle, builder: Builder) { let mut builder = builder.init_session(); builder.set_machine_system(capnp_rpc::new_client(Machines::new(session.clone()))); builder.set_user_system(capnp_rpc::new_client(Users::new(session.clone()))); diff --git a/bffhd/capnp/user.rs b/bffhd/capnp/user.rs index 3ce5f3e..701eb21 100644 --- a/bffhd/capnp/user.rs +++ b/bffhd/capnp/user.rs @@ -1,4 +1,4 @@ -use api::permissionsystem_capnp::permission_system::Server as PermissionSystem; + use api::user_capnp::user::{ info, manage, diff --git a/bffhd/capnp/user_system.rs b/bffhd/capnp/user_system.rs index ffce3b8..0ed628c 100644 --- a/bffhd/capnp/user_system.rs +++ b/bffhd/capnp/user_system.rs @@ -1,13 +1,11 @@ -use capnp::capability::Promise; -use capnp::Error; -use capnp_rpc::pry; + + + use api::usersystem_capnp::user_system::{ - Server as UserSystem, - info, info::Server as InfoServer, - manage, manage::Server as ManageServer, + Server as UserSystem, info::Server as InfoServer, manage::Server as ManageServer, }; -use crate::authorization::AuthorizationHandle; + use crate::session::SessionHandle; #[derive(Clone)] diff --git a/bffhd/config.rs b/bffhd/config.rs index 602a9a2..fea704c 100644 --- a/bffhd/config.rs +++ b/bffhd/config.rs @@ -2,13 +2,13 @@ use std::default::Default; use std::path::{Path, PathBuf}; use std::collections::HashMap; -use serde::{Serialize, Deserialize, Deserializer, Serializer}; +use serde::{Serialize, Deserialize}; use std::fmt::Formatter; -use std::net::{SocketAddr, IpAddr, ToSocketAddrs}; -use std::str::FromStr; -use serde::de::Error; -use crate::authorization::permissions::{PermRule, PrivilegesBuf}; +use std::net::{ToSocketAddrs}; + + +use crate::authorization::permissions::{PrivilegesBuf}; use crate::authorization::roles::Role; type Result = std::result::Result; @@ -153,7 +153,7 @@ impl Default for Config { fn default() -> Self { let mut actors: HashMap:: = HashMap::new(); let mut initiators: HashMap:: = HashMap::new(); - let mut machines = HashMap::new(); + let machines = HashMap::new(); actors.insert("Actor".to_string(), ModuleConfig { module: "Shelly".to_string(), diff --git a/bffhd/db/index.rs b/bffhd/db/index.rs index 117c954..a2516b8 100644 --- a/bffhd/db/index.rs +++ b/bffhd/db/index.rs @@ -1,13 +1,13 @@ -use std::{fs, io}; +use std::{fs}; use std::collections::HashMap; use std::fmt::{Debug, Display, Formatter}; use std::io::Write; use std::path::Path; use std::sync::atomic::{AtomicU64, Ordering}; -use std::sync::{Mutex, RwLock}; +use std::sync::{RwLock}; use anyhow::Context; -use lmdb::Environment; -use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Infallible, Fallible, ArchiveUnsized, SerializeUnsized}; + +use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Fallible}; use rkyv::de::deserializers::SharedDeserializeMap; use rkyv::ser::Serializer; use rkyv::ser::serializers::{AlignedSerializer, AllocScratch, AllocScratchError, AllocSerializer, CompositeSerializer, CompositeSerializerError, FallbackScratch, HeapScratch, ScratchTracker, SharedSerializeMap, SharedSerializeMapError}; @@ -131,7 +131,7 @@ impl DbIndexManager let mut serializer = Ser::default(); tracing::trace!(?serializer, "serializing db index"); let root = serializer.serialize_value(self).context("serializing database index failed")?; - let (s, c, h) = serializer.0.into_components(); + let (s, c, _h) = serializer.0.into_components(); let v = s.into_inner(); tracing::trace!(%root, len = v.len(), diff --git a/bffhd/db/mod.rs b/bffhd/db/mod.rs index 7be546c..b610639 100644 --- a/bffhd/db/mod.rs +++ b/bffhd/db/mod.rs @@ -12,7 +12,7 @@ pub use lmdb::{ RwTransaction, }; -use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec, Archived}; +use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec}; mod raw; pub use raw::RawDB; @@ -40,18 +40,18 @@ pub use fix::LMDBorrow; use lmdb::Error; use rkyv::Deserialize; use rkyv::ser::serializers::AlignedSerializer; -use std::sync::Arc; -use std::path::Path; -use crate::users::db::{User, UserDB}; + + +use crate::users::db::{User}; use std::collections::HashMap; use std::fmt::{Display, Formatter}; use rkyv::Infallible; -use crate::resources::state::{State, db::StateDB}; +use crate::resources::state::{State}; use std::iter::FromIterator; use std::ops::Deref; use crate::resources::search::ResourcesHandle; -use crate::utils::oid::{ArchivedObjectIdentifier, ObjectIdentifier}; -use crate::resources::state::value::SerializeValue; + + use crate::Users; #[derive(Debug)] diff --git a/bffhd/initiators/mod.rs b/bffhd/initiators/mod.rs index 2ddbe08..269e8ac 100644 --- a/bffhd/initiators/mod.rs +++ b/bffhd/initiators/mod.rs @@ -148,7 +148,7 @@ impl + Unpin, I: Initiator + Unpin> Future for Init // TODO: Log initiator error here } } - } else if let Some(ref mut resource) = self.resource { + } else if let Some(ref mut _resource) = self.resource { let mut s = self.update_sink.clone(); let f = self.initiator.run(&mut s); self.initiator_future.replace(f); diff --git a/bffhd/lib.rs b/bffhd/lib.rs index e78d223..05c0136 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -39,24 +39,24 @@ mod logging; mod audit; mod session; -use std::collections::HashMap; -use std::fs::File; -use std::io::BufReader; -use std::path::Path; -use std::sync::{Arc, Mutex}; -use std::time::Duration; + + + + +use std::sync::{Arc}; + use anyhow::Context; -use futures_rustls::TlsAcceptor; + use futures_util::StreamExt; use once_cell::sync::OnceCell; -use rustls::{Certificate, KeyLogFile, PrivateKey, ServerConfig}; -use rustls::server::NoClientAuth; + + use signal_hook::consts::signal::*; use executor::pool::Executor; use crate::authentication::AuthenticationHandle; use crate::authorization::roles::Roles; use crate::capnp::APIServer; -use crate::config::{Config, TlsListen}; +use crate::config::{Config}; use crate::resources::modules::fabaccess::MachineState; use crate::resources::Resource; use crate::resources::search::ResourcesHandle; @@ -121,7 +121,7 @@ impl Diflouroborane { let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); let authentication = AuthenticationHandle::new(self.users.clone()); - let mut apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?; + let apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?; let (mut tx, rx) = async_oneshot::oneshot(); diff --git a/bffhd/logging.rs b/bffhd/logging.rs index a008240..eb4852c 100644 --- a/bffhd/logging.rs +++ b/bffhd/logging.rs @@ -1,8 +1,8 @@ -use tracing_subscriber::{EnvFilter, fmt}; +use tracing_subscriber::{EnvFilter}; use crate::Config; pub fn init(config: &Config) { - let mut builder = tracing_subscriber::fmt() + let builder = tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()); let format = config.log_format.to_lowercase(); match format.as_str() { diff --git a/bffhd/resources/db.rs b/bffhd/resources/db.rs index 8010175..be5adfc 100644 --- a/bffhd/resources/db.rs +++ b/bffhd/resources/db.rs @@ -1,12 +1,12 @@ use rkyv::{Archive, Serialize, Deserialize}; -use crate::db::DB; -use crate::db::{AlignedAdapter, AllocAdapter}; -use crate::db::RawDB; -use std::sync::Arc; -use crate::db::{Environment, DatabaseFlags}; -use crate::db::Result; -use crate::resources::state::db::StateDB; + + + + + + + #[derive(Clone, Debug, PartialEq, Eq)] #[derive(Archive, Serialize, Deserialize)] diff --git a/bffhd/resources/mod.rs b/bffhd/resources/mod.rs index 79c6ed5..91ae695 100644 --- a/bffhd/resources/mod.rs +++ b/bffhd/resources/mod.rs @@ -1,4 +1,4 @@ -use std::ops::Deref; + use std::sync::Arc; use futures_signals::signal::{Mutable, Signal, SignalExt}; use lmdb::RoTransaction; diff --git a/bffhd/resources/modules/fabaccess.rs b/bffhd/resources/modules/fabaccess.rs index adeef2c..8912c85 100644 --- a/bffhd/resources/modules/fabaccess.rs +++ b/bffhd/resources/modules/fabaccess.rs @@ -1,14 +1,14 @@ -use std::ops::Deref; + use crate::utils::oid::ObjectIdentifier; use once_cell::sync::Lazy; -use rkyv::{Archive, Archived, Deserialize, Serialize, Infallible}; -use rkyv_dyn::{DynError, DynSerializer}; +use rkyv::{Archive, Archived, Deserialize, Infallible}; + use std::str::FromStr; use crate::oidvalue; use crate::resources::state::{State}; -use crate::resources::state::value::Value; -use crate::session::SessionHandle; + + use crate::users::UserRef; /// Status of a Machine @@ -66,7 +66,7 @@ impl MachineState { } pub fn from(dbstate: &Archived) -> Self { - use std::any::TypeId; + let state: &Archived = &dbstate.inner; Deserialize::deserialize(state, &mut Infallible).unwrap() } diff --git a/bffhd/resources/state/mod.rs b/bffhd/resources/state/mod.rs index 69e02a3..8859169 100644 --- a/bffhd/resources/state/mod.rs +++ b/bffhd/resources/state/mod.rs @@ -1,8 +1,6 @@ use std::{ - collections::hash_map::DefaultHasher, fmt, hash::{ - Hash, Hasher }, }; @@ -11,7 +9,6 @@ use std::ops::Deref; use rkyv::{ Archive, - Archived, Deserialize, out_field, Serialize, @@ -20,12 +17,12 @@ use serde::de::{Error, MapAccess, Unexpected}; use serde::Deserializer; use serde::ser::SerializeMap; -use value::{RegisteredImpl, SerializeValue}; + use crate::MachineState; use crate::resources::modules::fabaccess::OID_VALUE; use crate::utils::oid::ObjectIdentifier; -use crate::resources::state::value::{DynOwnedVal, DynVal, TypeOid, Value}; + pub mod value; pub mod db; diff --git a/bffhd/resources/state/value.rs b/bffhd/resources/state/value.rs index 0367f2c..53c913e 100644 --- a/bffhd/resources/state/value.rs +++ b/bffhd/resources/state/value.rs @@ -6,7 +6,7 @@ use rkyv::{ DeserializeUnsized, Fallible, Serialize, SerializeUnsized, }; use rkyv_dyn::{DynDeserializer, DynError, DynSerializer}; -use rkyv_typename::TypeName; + use crate::utils::oid::ObjectIdentifier; use inventory; @@ -544,7 +544,7 @@ pub mod macros { }; } } -use macros::*; + lazy_static::lazy_static! { pub static ref OID_BOOL: ObjectIdentifier = { diff --git a/bffhd/session/mod.rs b/bffhd/session/mod.rs index 4e0ccfb..84635df 100644 --- a/bffhd/session/mod.rs +++ b/bffhd/session/mod.rs @@ -1,9 +1,9 @@ -use std::path::PathBuf; -use std::sync::Arc; -use anyhow::Context; -use lmdb::Environment; + + + + use once_cell::sync::OnceCell; -use crate::authorization::roles::{Role, Roles}; +use crate::authorization::roles::{Roles}; use crate::resources::Resource; use crate::session::db::SessionCache; use crate::Users; diff --git a/bffhd/tls.rs b/bffhd/tls.rs index c8455d1..9f46bab 100644 --- a/bffhd/tls.rs +++ b/bffhd/tls.rs @@ -3,13 +3,13 @@ use std::io; use std::io::BufReader; use std::path::Path; use std::sync::Arc; -use anyhow::anyhow; + use futures_rustls::TlsAcceptor; use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite}; use rustls::version::{TLS12, TLS13}; -use tracing::{Level, Span}; +use tracing::{Level}; use crate::config; -use crate::config::Listen; + use crate::keylog::KeyLogFile; fn lookup_cipher_suite(name: &str) -> Option { @@ -84,11 +84,11 @@ impl TlsConfig { } }; - let mut tls_builder = ServerConfig::builder() + let tls_builder = ServerConfig::builder() .with_safe_default_cipher_suites() .with_safe_default_kx_groups(); - let mut tls_builder = if let Some(ref min) = config.tls_min_version { + let tls_builder = if let Some(ref min) = config.tls_min_version { match min.as_str() { "tls12" => tls_builder.with_protocol_versions(&[&TLS12]), "tls13" => tls_builder.with_protocol_versions(&[&TLS13]), diff --git a/bffhd/users/db.rs b/bffhd/users/db.rs index 18ecda9..f852c31 100644 --- a/bffhd/users/db.rs +++ b/bffhd/users/db.rs @@ -1,8 +1,8 @@ use crate::db::{AllocAdapter, Environment, RawDB, Result, DB}; use crate::db::{DatabaseFlags, LMDBorrow, RoTransaction, WriteFlags}; -use lmdb::{RwTransaction, Transaction}; -use std::collections::{HashMap, HashSet}; -use std::path::Path; +use lmdb::{Transaction}; +use std::collections::{HashMap}; + use std::sync::Arc; use anyhow::Context; diff --git a/bffhd/users/mod.rs b/bffhd/users/mod.rs index 2a4639e..efc3bbb 100644 --- a/bffhd/users/mod.rs +++ b/bffhd/users/mod.rs @@ -25,8 +25,8 @@ use std::sync::Arc; pub mod db; -use crate::authorization::roles::Role; -use crate::db::LMDBorrow; + + use crate::users::db::UserData; use crate::UserDB; @@ -93,7 +93,7 @@ impl Users { pub fn load_file>(&self, path: P) -> anyhow::Result<()> { let f = std::fs::read(path)?; - let mut map: HashMap = toml::from_slice(&f)?; + let map: HashMap = toml::from_slice(&f)?; for (uid, mut userdata) in map { userdata.passwd = userdata.passwd.map(|pw| { diff --git a/bffhd/utils/l10nstring.rs b/bffhd/utils/l10nstring.rs index ccadc9f..60f53a5 100644 --- a/bffhd/utils/l10nstring.rs +++ b/bffhd/utils/l10nstring.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; -use capnp::capability::Promise; -use capnp::Error; -use capnp_rpc::pry; + + + use once_cell::sync::Lazy; struct Locales { diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 9905aa0..b33856c 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -1,15 +1,15 @@ use clap::{Arg, Command}; use diflouroborane::db::Dump; -use diflouroborane::{config, Diflouroborane, error::Error}; -use std::net::ToSocketAddrs; -use std::os::unix::prelude::AsRawFd; +use diflouroborane::{config, Diflouroborane}; + + use std::str::FromStr; use std::{env, io, io::Write, path::PathBuf}; -use std::sync::Arc; -use anyhow::Context; -use lmdb::{Environment, EnvironmentFlags}; + + + use nix::NixPath; -use diflouroborane::users::Users; + fn main() -> anyhow::Result<()> { // Argument parsing