-
Notifications
You must be signed in to change notification settings - Fork 411
Rustfmt chainmonitor.rs #3847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Rustfmt chainmonitor.rs #3847
Conversation
👋 Thanks for assigning @valentinewallace as a reviewer! |
Presumably we should just format all of |
Happy to do that. I just wanted to be conservative and only format the parts that I touch. |
df28592
to
d0e501a
Compare
Pushed full rustfmt'ed chainmonitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine to do these in follow-up if you want to Just Land
lightning/src/chain/chainmonitor.rs
Outdated
self.monitors | ||
.read() | ||
.unwrap() | ||
.iter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extract into var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on CI failures, looks like you might have to extract only self.monitors.read().unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Done
match super::channelmonitor::process_events_body!( | ||
self.monitors.read().unwrap().get(&channel_id).map(|m| &m.monitor), self.logger, ev, handler(ev).await) { | ||
self.monitors.read().unwrap().get(&channel_id).map(|m| &m.monitor), | ||
self.logger, | ||
ev, | ||
handler(ev).await | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer:
for channel_id in mons_to_process {
let mut ev;
let monitor = self.monitors.read().unwrap().get(&channel_id).map(|m| &m.monitor);
let res = process_events_body!(monitor, self.logger, ev, handler(ev).await);
match res {
Ok(()) => {},
Err(ReplayEvent()) => {
self.event_notifier.notify();
},
}
}
with importing process_events_body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This starts to complain about borrow from a temporary value. Left as is, this is formatting only?
Certainly if you don't want to bother cleaning things up we can just land a subset that doesn't need it and come back to it later, I was just suggesting it probably wasn't much effort to clean up as we went given the file's size. |
Right. Yes, the clean up is kind of subjective, so wanted to avoid that. But will now go with @valentinewallace's suggestions above. |
ab6d893
to
449591a
Compare
Rebased |
449591a
to
3242b93
Compare
I badly miss rustfmt for my changes in #3778.
The larger strategy for rustfmt is still being discussed (#3749, #3809), but getting this one with immediate benefit through would be great.