From 3fdf252bd3eb5edacaca0d4488c05778249569dd Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 12 Apr 2021 17:59:11 -0400 Subject: [PATCH] Improve + fix indentation and style in lightning-persister --- lightning-persister/src/lib.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index 74e05d4c6..f6fbc635d 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -52,11 +52,12 @@ impl DiskWriteable for ChannelMonitor { } impl DiskWriteable for ChannelManager -where M::Target: chain::Watch, - T::Target: BroadcasterInterface, - K::Target: KeysInterface, - F::Target: FeeEstimator, - L::Target: Logger +where + M::Target: chain::Watch, + T::Target: BroadcasterInterface, + K::Target: KeysInterface, + F::Target: FeeEstimator, + L::Target: Logger, { fn write_to_file(&self, writer: &mut fs::File) -> Result<(), std::io::Error> { self.write(writer) @@ -89,11 +90,12 @@ impl FilesystemPersister { data_dir: String, manager: &ChannelManager ) -> Result<(), std::io::Error> - where M::Target: chain::Watch, - T::Target: BroadcasterInterface, - K::Target: KeysInterface, - F::Target: FeeEstimator, - L::Target: Logger + where + M::Target: chain::Watch, + T::Target: BroadcasterInterface, + K::Target: KeysInterface, + F::Target: FeeEstimator, + L::Target: Logger, { let path = PathBuf::from(data_dir); util::write_to_file(path, "manager".to_string(), manager) @@ -103,7 +105,7 @@ impl FilesystemPersister { pub fn read_channelmonitors ( &self, keys_manager: K ) -> Result)>, std::io::Error> - where K::Target: KeysInterface + Sized + where K::Target: KeysInterface + Sized, { let path = self.path_to_monitor_data(); if !Path::new(&path).exists() { @@ -160,13 +162,13 @@ impl channelmonitor::Persist for FilesystemP fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor) -> Result<(), ChannelMonitorUpdateErr> { let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index); util::write_to_file(self.path_to_monitor_data(), filename, monitor) - .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) + .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) } fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &ChannelMonitorUpdate, monitor: &ChannelMonitor) -> Result<(), ChannelMonitorUpdateErr> { let filename = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index); util::write_to_file(self.path_to_monitor_data(), filename, monitor) - .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) + .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure) } } -- 2.39.5