From df64d43e03006306479aefb6455c65d1d19128d5 Mon Sep 17 00:00:00 2001 From: Kai Jan Kriegel Date: Tue, 26 Apr 2022 23:21:43 +0200 Subject: [PATCH] ran cargo fix --- bffhd/actors/dummy.rs | 2 +- bffhd/actors/mod.rs | 4 ++-- bffhd/actors/process.rs | 2 +- bffhd/actors/shelly.rs | 2 +- bffhd/authentication/fabfire/server.rs | 4 ++-- bffhd/authentication/mod.rs | 2 +- bffhd/capnp/machine.rs | 2 +- bffhd/capnp/user.rs | 8 ++++---- bffhd/capnp/user_system.rs | 5 ++--- bffhd/config/mod.rs | 8 ++++---- bffhd/db/typed.rs | 4 ++-- bffhd/logging.rs | 2 +- bffhd/resources/mod.rs | 4 ++-- bffhd/resources/modules/fabaccess.rs | 2 +- bffhd/resources/state/db.rs | 2 +- bffhd/resources/state/mod.rs | 8 ++++---- bffhd/resources/state/value.rs | 16 ++++++++-------- bffhd/session/mod.rs | 2 +- bffhd/tls.rs | 2 +- bffhd/users/db.rs | 4 ++-- bffhd/users/mod.rs | 2 +- 21 files changed, 43 insertions(+), 44 deletions(-) diff --git a/bffhd/actors/dummy.rs b/bffhd/actors/dummy.rs index 4cf19e2..30736e9 100644 --- a/bffhd/actors/dummy.rs +++ b/bffhd/actors/dummy.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use futures_util::future; use futures_util::future::BoxFuture; -use rkyv::Archived; + use crate::actors::Actor; use crate::db::ArchivedValue; use crate::resources::state::State; diff --git a/bffhd/actors/mod.rs b/bffhd/actors/mod.rs index 176dd90..f3d9c0d 100644 --- a/bffhd/actors/mod.rs +++ b/bffhd/actors/mod.rs @@ -6,7 +6,7 @@ use executor::pool::Executor; 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; @@ -17,7 +17,7 @@ use std::time::Duration; use once_cell::sync::Lazy; use rumqttc::ConnectReturnCode::Success; -use rumqttc::Packet::ConnAck; + use rustls::{RootCertStore}; use url::Url; use crate::actors::dummy::Dummy; diff --git a/bffhd/actors/process.rs b/bffhd/actors/process.rs index 839c355..92f94f8 100644 --- a/bffhd/actors/process.rs +++ b/bffhd/actors/process.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::process::{Command, Stdio}; use futures_util::future::BoxFuture; -use rkyv::Archived; + use crate::actors::Actor; use crate::db::ArchivedValue; use crate::resources::modules::fabaccess::ArchivedStatus; diff --git a/bffhd/actors/shelly.rs b/bffhd/actors/shelly.rs index 3a52175..df85b93 100644 --- a/bffhd/actors/shelly.rs +++ b/bffhd/actors/shelly.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; use futures_util::future::BoxFuture; -use rkyv::Archived; + use rumqttc::{AsyncClient, QoS}; use crate::actors::Actor; use crate::db::ArchivedValue; diff --git a/bffhd/authentication/fabfire/server.rs b/bffhd/authentication/fabfire/server.rs index 4ed4db0..eacc5dd 100644 --- a/bffhd/authentication/fabfire/server.rs +++ b/bffhd/authentication/fabfire/server.rs @@ -12,7 +12,7 @@ use std::convert::TryFrom; use std::sync::Arc; use desfire::desfire::desfire::MAX_BYTES_PER_TRANSACTION; use rsasl::property::AuthId; -use tracing::{error, trace}; + use crate::authentication::fabfire::FabFireCardKey; enum FabFireError { @@ -606,7 +606,7 @@ impl Authentication for FabFire { } }; } - Err(e) => { + Err(_e) => { tracing::error!("Got invalid response: {:?}", apdu_response); return Err(FabFireError::InvalidCredentials(format!("{}", apdu_response)).into()); } diff --git a/bffhd/authentication/mod.rs b/bffhd/authentication/mod.rs index de74314..de88f06 100644 --- a/bffhd/authentication/mod.rs +++ b/bffhd/authentication/mod.rs @@ -7,7 +7,7 @@ use rsasl::session::{Session, SessionData}; use rsasl::validate::{validations, Validation}; use rsasl::{Property, SASL}; use std::sync::Arc; -use rsasl::registry::Mechanism; + use crate::authentication::fabfire::FabFireCardKey; mod fabfire; diff --git a/bffhd/capnp/machine.rs b/bffhd/capnp/machine.rs index 2447ccd..f36386c 100644 --- a/bffhd/capnp/machine.rs +++ b/bffhd/capnp/machine.rs @@ -88,7 +88,7 @@ impl Machine { pub fn optional_build(session: SessionHandle, resource: Resource, builder: optional::Builder) { let this = Self::new(session.clone(), resource.clone()); if this.resource.visible(&session) || session.has_read(&resource) { - let mut builder = builder.init_just(); + let builder = builder.init_just(); this.build_into(builder); } } diff --git a/bffhd/capnp/user.rs b/bffhd/capnp/user.rs index 85890a5..ad35093 100644 --- a/bffhd/capnp/user.rs +++ b/bffhd/capnp/user.rs @@ -24,12 +24,12 @@ impl User { pub fn build_optional(&self, user: Option, builder: optional::Builder) { if let Some(user) = user.and_then(|u| self.session.users.get_user(u.get_username())) { - let mut builder = builder.init_just(); + let builder = builder.init_just(); self.fill(user, builder); } } - pub fn build(session: SessionHandle, mut builder: user::Builder) { + pub fn build(session: SessionHandle, builder: user::Builder) { let this = Self::new_self(session); let user = this.session.get_user(); this.fill(user, builder); @@ -74,8 +74,8 @@ impl info::Server for User { impl manage::Server for User { fn pwd( &mut self, - params: manage::PwdParams, - mut results: manage::PwdResults, + _params: manage::PwdParams, + _results: manage::PwdResults, ) -> Promise<(), ::capnp::Error> { Promise::err(::capnp::Error::unimplemented( "method not implemented".to_string(), diff --git a/bffhd/capnp/user_system.rs b/bffhd/capnp/user_system.rs index d83e847..eebd246 100644 --- a/bffhd/capnp/user_system.rs +++ b/bffhd/capnp/user_system.rs @@ -2,13 +2,12 @@ use capnp::capability::Promise; use capnp_rpc::pry; use api::usersystem_capnp::user_system::{ info, manage, - self as system, }; -use crate::authorization::permissions::Permission; + use crate::capnp::user::User; use crate::session::SessionHandle; -use crate::users::UserRef; + #[derive(Clone)] pub struct Users { diff --git a/bffhd/config/mod.rs b/bffhd/config/mod.rs index 2fe0ec5..5eeb860 100644 --- a/bffhd/config/mod.rs +++ b/bffhd/config/mod.rs @@ -1,12 +1,12 @@ use std::default::Default; -use std::path::{Path, PathBuf}; +use std::path::{PathBuf}; use std::collections::HashMap; use serde::{Serialize, Deserialize}; -use std::fmt::Formatter; -use std::net::{ToSocketAddrs}; -use serde_dhall::StaticType; + + + mod dhall; diff --git a/bffhd/db/typed.rs b/bffhd/db/typed.rs index 984a031..fdfa892 100644 --- a/bffhd/db/typed.rs +++ b/bffhd/db/typed.rs @@ -1,10 +1,10 @@ use crate::db::RawDB; use lmdb::{Cursor, RwTransaction, Transaction, WriteFlags}; -use rkyv::{AlignedVec, Archive, Archived, Serialize}; +use rkyv::{AlignedVec, Archive, Archived}; use std::fmt; use std::fmt::{Debug, Display, Formatter}; use std::marker::PhantomData; -use std::pin::Pin; + use crate::db; #[derive(Clone)] diff --git a/bffhd/logging.rs b/bffhd/logging.rs index 9ef1ed3..3144630 100644 --- a/bffhd/logging.rs +++ b/bffhd/logging.rs @@ -1,5 +1,5 @@ use tracing_subscriber::{EnvFilter}; -use crate::Config; + use serde::{Serialize, Deserialize}; diff --git a/bffhd/resources/mod.rs b/bffhd/resources/mod.rs index 02a9d21..08cd424 100644 --- a/bffhd/resources/mod.rs +++ b/bffhd/resources/mod.rs @@ -1,8 +1,8 @@ use rkyv::Infallible; use std::ops::Deref; use std::sync::Arc; -use futures_signals::signal::{Mutable, Signal, SignalExt}; -use lmdb::RoTransaction; +use futures_signals::signal::{Mutable, Signal}; + use rkyv::{Archived, Deserialize}; use rkyv::option::ArchivedOption; use rkyv::ser::Serializer; diff --git a/bffhd/resources/modules/fabaccess.rs b/bffhd/resources/modules/fabaccess.rs index 735c522..c0c016d 100644 --- a/bffhd/resources/modules/fabaccess.rs +++ b/bffhd/resources/modules/fabaccess.rs @@ -1,5 +1,5 @@ use std::fmt; -use std::fmt::{Write, write}; +use std::fmt::{Write}; use crate::utils::oid::ObjectIdentifier; use once_cell::sync::Lazy; use rkyv::{Archive, Archived, Deserialize, Infallible}; diff --git a/bffhd/resources/state/db.rs b/bffhd/resources/state/db.rs index 933adab..43b9f57 100644 --- a/bffhd/resources/state/db.rs +++ b/bffhd/resources/state/db.rs @@ -1,7 +1,7 @@ use crate::db; use crate::db::{ArchivedValue, RawDB, DB, AlignedAdapter}; use lmdb::{ - DatabaseFlags, Environment, EnvironmentFlags, RoTransaction, RwTransaction, Transaction, + DatabaseFlags, Environment, EnvironmentFlags, Transaction, WriteFlags, }; use std::{path::Path, sync::Arc}; diff --git a/bffhd/resources/state/mod.rs b/bffhd/resources/state/mod.rs index 1d5ccb6..4f1df59 100644 --- a/bffhd/resources/state/mod.rs +++ b/bffhd/resources/state/mod.rs @@ -5,11 +5,11 @@ use std::{ }, }; use std::fmt::{Debug, Display, Formatter}; -use std::marker::PhantomData; -use std::ops::Deref; -use std::sync::Arc; -use rkyv::{AlignedVec, Archive, Archived, Deserialize, out_field, Serialize}; +use std::ops::Deref; + + +use rkyv::{Archive, Deserialize, out_field, Serialize}; use serde::de::{Error, MapAccess, Unexpected}; use serde::Deserializer; use serde::ser::SerializeMap; diff --git a/bffhd/resources/state/value.rs b/bffhd/resources/state/value.rs index a1649a0..7b021b3 100644 --- a/bffhd/resources/state/value.rs +++ b/bffhd/resources/state/value.rs @@ -1,8 +1,8 @@ -use std::{any::Any, fmt, hash::Hash, ptr, str::FromStr}; +use std::{hash::Hash}; use ptr_meta::{DynMetadata, Pointee}; -use rkyv::{out_field, Archive, ArchivePointee, ArchiveUnsized, Archived, ArchivedMetadata, Deserialize, DeserializeUnsized, Fallible, Serialize, SerializeUnsized, RelPtr}; -use rkyv_dyn::{DynDeserializer, DynError, DynSerializer}; +use rkyv::{out_field, Archive, ArchivePointee, ArchiveUnsized, Archived, ArchivedMetadata, Serialize, SerializeUnsized, RelPtr}; +use rkyv_dyn::{DynError, DynSerializer}; use crate::utils::oid::ObjectIdentifier; @@ -11,15 +11,15 @@ use crate::utils::oid::ObjectIdentifier; use inventory; use rkyv::ser::{ScratchSpace, Serializer}; -use serde::de::Error as SerdeError; + use serde::ser::SerializeMap; -use std::alloc::Layout; + use std::collections::HashMap; -use std::fmt::Formatter; -use std::mem::MaybeUninit; + + use std::ops::Deref; use std::sync::atomic::{AtomicUsize, Ordering}; -use rkyv::boxed::{ArchivedBox, BoxResolver}; + use rkyv::vec::ArchivedVec; #[repr(transparent)] diff --git a/bffhd/session/mod.rs b/bffhd/session/mod.rs index 916debd..517b14d 100644 --- a/bffhd/session/mod.rs +++ b/bffhd/session/mod.rs @@ -2,7 +2,7 @@ -use once_cell::sync::OnceCell; + use crate::authorization::permissions::Permission; use crate::authorization::roles::{Roles}; use crate::resources::Resource; diff --git a/bffhd/tls.rs b/bffhd/tls.rs index 69e5952..9bceb72 100644 --- a/bffhd/tls.rs +++ b/bffhd/tls.rs @@ -9,7 +9,7 @@ use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite}; use rustls::version::{TLS12, TLS13}; use tracing::{Level}; use crate::capnp::TlsListen; -use crate::config; + use crate::keylog::KeyLogFile; diff --git a/bffhd/users/db.rs b/bffhd/users/db.rs index 7aa16ab..1779478 100644 --- a/bffhd/users/db.rs +++ b/bffhd/users/db.rs @@ -5,7 +5,7 @@ use rkyv::Infallible; use std::sync::Arc; use anyhow::Context; -use rkyv::{Archived, Deserialize}; +use rkyv::{Deserialize}; use rkyv::ser::Serializer; use rkyv::ser::serializers::AllocSerializer; use crate::db; @@ -118,7 +118,7 @@ impl UserDB { pub fn get_all(&self) -> Result, db::Error> { let txn = self.env.begin_ro_txn()?; - let mut iter = self.db.get_all(&txn)?; + let iter = self.db.get_all(&txn)?; let mut out = Vec::new(); for (uid, user) in iter { let uid = unsafe { std::str::from_utf8_unchecked(uid).to_string() }; diff --git a/bffhd/users/mod.rs b/bffhd/users/mod.rs index d42a8da..5ba84c5 100644 --- a/bffhd/users/mod.rs +++ b/bffhd/users/mod.rs @@ -4,7 +4,7 @@ use once_cell::sync::OnceCell; use rkyv::{Archive, Deserialize, Infallible, Serialize}; use std::collections::HashMap; use std::fmt::{Display, Formatter, Write}; -use std::ops::Deref; + use std::path::Path; use std::sync::Arc;