fix clippy::ref_option

fix needless borrow

fix clippy::nonminimal_bool
This commit is contained in:
Jason Volk 2024-10-27 00:30:30 +00:00
parent 5e6dbaa27f
commit 9787dfe77c
11 changed files with 24 additions and 30 deletions

View file

@ -370,9 +370,9 @@ impl Service {
/// Sets the self-reference to crate::Services which will provide context to
/// the admin commands.
pub(super) fn set_services(&self, services: &Option<Arc<crate::Services>>) {
pub(super) fn set_services(&self, services: Option<&Arc<crate::Services>>) {
let receiver = &mut *self.services.services.write().expect("locked for writing");
let weak = services.as_ref().map(Arc::downgrade);
let weak = services.map(Arc::downgrade);
*receiver = weak;
}
}

View file

@ -113,7 +113,7 @@ impl Services {
pub async fn start(self: &Arc<Self>) -> Result<Arc<Self>> {
debug_info!("Starting services...");
self.admin.set_services(&Some(Arc::clone(self)));
self.admin.set_services(Some(Arc::clone(self)).as_ref());
globals::migrations::migrations(self).await?;
self.manager
.lock()
@ -151,7 +151,7 @@ impl Services {
manager.stop().await;
}
self.admin.set_services(&None);
self.admin.set_services(None);
debug_info!("Services shutdown complete.");
}