Changes suggested by clippy

This commit is contained in:
Brian Picciano 2023-07-04 19:42:12 +02:00
parent 6863694293
commit 773001b158
6 changed files with 25 additions and 16 deletions

View File

@ -163,18 +163,21 @@ impl ManagerImpl {
domain_config_store: DomainConfigStore,
domain_checker: checker::DNSChecker,
acme_manager: Option<AcmeManager>,
) -> sync::Arc<dyn Manager> {
) -> sync::Arc<Self> {
let manager = sync::Arc::new(ManagerImpl {
origin_store: Box::from(origin_store),
domain_config_store: Box::from(domain_config_store),
domain_checker: domain_checker,
domain_checker,
acme_manager: acme_manager
.map(|m| Box::new(m) as Box<dyn acme::manager::Manager + Send + Sync>),
});
task_stack.push_spawn(|canceller| {
let manager = manager.clone();
async move { Ok(manager.sync_origins(canceller).await) }
async move {
manager.sync_origins(canceller).await;
Ok(())
}
});
manager
@ -194,8 +197,7 @@ impl ManagerImpl {
}
.for_each(|descr| {
if let Err(err) = self.origin_store.sync(&descr) {
log::error!("Failed to sync store for {:?}: {err}", descr);
return;
log::error!("Failed to sync store for {:?}: {err}", descr)
}
});
},

View File

@ -103,7 +103,7 @@ impl<T, E: error::Error> Mappable<T> for Result<T, E> {
}
}
static OPTION_NONE_ERROR: &'static str = "expected Some but got None";
static OPTION_NONE_ERROR: &str = "expected Some but got None";
impl<T> Mappable<T> for Option<T> {
fn or_unexpected(self) -> Result<T, Error> {

View File

@ -125,8 +125,8 @@ async fn main() {
domain_manager.clone(),
config.domain_checker_target_a,
config.passphrase,
config.http_listen_addr.clone(),
config.http_domain.clone(),
config.http_listen_addr,
config.http_domain,
config
.https_listen_addr
.map(|listen_addr| domani::service::http::HTTPSParams {

View File

@ -216,7 +216,7 @@ impl super::Store for FSStore {
let res = self.sync_inner(descr);
self.sync_guard.lock().unwrap().remove(&descr);
self.sync_guard.lock().unwrap().remove(descr);
let repo = match res {
Ok(repo) => repo,
@ -232,7 +232,7 @@ impl super::Store for FSStore {
// calling this while the sync lock is held isn't ideal, but it's convenient and
// shouldn't be too terrible generally
let origin = self.get_origin(repo, &descr).map_err(|e| match e {
let origin = self.get_origin(repo, descr).map_err(|e| match e {
GetOriginError::InvalidBranchName => store::SyncError::InvalidBranchName,
GetOriginError::Unexpected(e) => store::SyncError::Unexpected(e),
})?;
@ -251,7 +251,7 @@ impl super::Store for FSStore {
}
}
let repo_path = self.repo_path(&descr);
let repo_path = self.repo_path(descr);
fs::read_dir(&repo_path).map_err(|e| match e.kind() {
io::ErrorKind::NotFound => store::GetError::NotFound,
@ -270,7 +270,7 @@ impl super::Store for FSStore {
GetOriginError::Unexpected(e) => store::GetError::Unexpected(e),
})?;
let origin = sync::Arc::new(origin.clone());
let origin = sync::Arc::new(origin);
let mut origins = self.origins.write().unwrap();

View File

@ -68,7 +68,7 @@ pub fn new(
});
}
return service;
service
}
#[derive(Serialize)]

View File

@ -62,10 +62,17 @@ where
self.wait_group.reverse();
for fut in self.wait_group {
if let Err(err) = fut.await {
return Err(err);
}
fut.await?;
}
Ok(())
}
}
impl<E> Default for TaskStack<E>
where
E: error::Error + Send + 'static,
{
fn default() -> Self {
Self::new()
}
}