-
Notifications
You must be signed in to change notification settings - Fork 402
Run rustfmt
on lightning-block-sync
#3136
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
Run rustfmt
on lightning-block-sync
#3136
Conversation
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.
LGTM.
Ran cargo fmt --package lightning-block-sync
on my side and there were no differences to this PR.
e548b89
to
e337aad
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3136 +/- ##
==========================================
- Coverage 89.82% 89.76% -0.06%
==========================================
Files 121 121
Lines 100404 100500 +96
Branches 100404 100500 +96
==========================================
+ Hits 90187 90217 +30
- Misses 7553 7605 +52
- Partials 2664 2678 +14 ☔ View full report in Codecov by Sentry. |
e337aad
to
de41b4d
Compare
Addressed outstanding feedback. |
Feel free to squash. |
de41b4d
to
1494f3b
Compare
Squashed without further changes: > git diff-tree -U2 de41b4d03 1494f3bb4
> |
We previously forgot to drop it (or it snuck back in during rebasing), so we drop `lightning-background-processor` from the rustfmt exclusion list.
1494f3b
to
12e4efa
Compare
Also added a commit dropping |
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.
LGTM, diff since @dunxen's ack were pretty simple code cleanups, so just gonna land:
$ git range-diff 3ccf06416091e107f443ee92027501105c48054b...e337aadf10656aa97feb7206bfb18b3233e6ef88 dd5d297d641facad24518cf2668cf1f38caf7dbc...12e4efa0ffd3b47a5d5952d1de83490a8f1b58b0
1: 6cc998a4e ! 1: 2f9bdc729 Prepare `convert.rs`
@@ lightning-block-sync/src/convert.rs: pub(crate) struct GetUtxosResponse {
- fn try_into(self) -> std::io::Result<GetUtxosResponse> {
+ fn try_into(self) -> io::Result<GetUtxosResponse> {
-+ let obj_err = io::Error::new(io::ErrorKind::InvalidData, "expected an object");
-+ let bitmap_err = io::Error::new(io::ErrorKind::InvalidData, "missing bitmap field");
-+ let bitstr_err = io::Error::new(io::ErrorKind::InvalidData, "bitmap should be an str");
++ let obj_err = || io::Error::new(io::ErrorKind::InvalidData, "expected an object");
++ let bitmap_err = || io::Error::new(io::ErrorKind::InvalidData, "missing bitmap field");
++ let bitstr_err = || io::Error::new(io::ErrorKind::InvalidData, "bitmap should be an str");
let bitmap_str =
- self.0.as_object().ok_or(std::io::Error::new(std::io::ErrorKind::InvalidData, "expected an object"))?
- .get("bitmap").ok_or(std::io::Error::new(std::io::ErrorKind::InvalidData, "missing bitmap field"))?
- .as_str().ok_or(std::io::Error::new(std::io::ErrorKind::InvalidData, "bitmap should be an str"))?;
-+ self.0.as_object().ok_or(obj_err)?
-+ .get("bitmap").ok_or(bitmap_err)?
-+ .as_str().ok_or(bitstr_err)?;
++ self.0.as_object().ok_or_else(obj_err)?
++ .get("bitmap").ok_or_else(bitmap_err)?
++ .as_str().ok_or_else(bitstr_err)?;
let mut hit_bitmap_nonempty = false;
for c in bitmap_str.chars() {
if c < '0' || c > '9' {
2: 38ff2dbf0 ! 2: 20669aeb7 `rustfmt`: Run on `lightning-block-sync/src/convert.rs`
@@ lightning-block-sync/src/convert.rs: impl TryInto<BlockHash> for JsonResponse {
#[cfg(feature = "rest-client")]
@@ lightning-block-sync/src/convert.rs: impl TryInto<GetUtxosResponse> for JsonResponse {
- let obj_err = io::Error::new(io::ErrorKind::InvalidData, "expected an object");
- let bitmap_err = io::Error::new(io::ErrorKind::InvalidData, "missing bitmap field");
- let bitstr_err = io::Error::new(io::ErrorKind::InvalidData, "bitmap should be an str");
+ let obj_err = || io::Error::new(io::ErrorKind::InvalidData, "expected an object");
+ let bitmap_err = || io::Error::new(io::ErrorKind::InvalidData, "missing bitmap field");
+ let bitstr_err = || io::Error::new(io::ErrorKind::InvalidData, "bitmap should be an str");
- let bitmap_str =
-- self.0.as_object().ok_or(obj_err)?
-- .get("bitmap").ok_or(bitmap_err)?
-- .as_str().ok_or(bitstr_err)?;
+- self.0.as_object().ok_or_else(obj_err)?
+- .get("bitmap").ok_or_else(bitmap_err)?
+- .as_str().ok_or_else(bitstr_err)?;
- let mut hit_bitmap_nonempty = false;
- for c in bitmap_str.chars() {
- if c < '0' || c > '9' {
@@ lightning-block-sync/src/convert.rs: impl TryInto<GetUtxosResponse> for JsonResp
+ let bitmap_str = self
+ .0
+ .as_object()
-+ .ok_or(obj_err)?
++ .ok_or_else(obj_err)?
+ .get("bitmap")
-+ .ok_or(bitmap_err)?
++ .ok_or_else(bitmap_err)?
+ .as_str()
-+ .ok_or(bitstr_err)?;
++ .ok_or_else(bitstr_err)?;
+ let mut hit_bitmap_nonempty = false;
+ for c in bitmap_str.chars() {
+ if c < '0' || c > '9' {
-: --------- > 3: 16614963c Prepare `lightning-block-sync/src/gossip.rs`
3: 76125a04d ! 4: 8975979fc `rustfmt`: Run on `lightning-block-sync/src/gossip.rs`
@@ lightning-block-sync/src/gossip.rs: impl<S: FutureSpawner,
let transaction_index = ((short_channel_id >> 2 * 8) & 0xffffff) as u32;
@@ lightning-block-sync/src/gossip.rs: impl<S: FutureSpawner,
- let (outpoint, output);
-
-- 'tx_found: loop { // Used as a simple goto
-+ 'tx_found: loop {
-+ // Used as a simple goto
+ 'tx_found: loop {
macro_rules! process_block {
- ($block: expr) => { {
+ ($block: expr) => {{
4: 3268adbc3 = 5: 310ad9a0e `rustfmt`: Run on `lightning-block-sync/src/http.rs`
5: ee65a9bf2 = 6: fb57e0405 `rustfmt`: Run on `lightning-block-sync/src/init.rs`
6: c53fb75a8 = 7: 26cacb60b `rustfmt`: Run on `lightning-block-sync/src/poll.rs`
7: decab2fec = 8: 634821a95 `rustfmt`: Run on `lightning-block-sync/src/rest.rs`
8: f2b11a149 = 9: 3ef5f18eb `rustfmt`: Run on `lightning-block-sync/src/rpc.rs`
9: d478ade42 = 10: ad7021ae3 `rustfmt`: Run on `lightning-block-sync/src/test_utils.rs`
10: 92e4035a5 = 11: 43abde8d7 `rustfmt`: Run on `lightning-block-sync/src/utils.rs`
11: 623ad51ce = 12: 9c2f4cb6c `rustfmt`: Run on `lightning-block-sync/src/lib.rs`
12: e337aadf1 = 13: 5e163da8d `rustfmt`: Drop `lightning-custom-message/src/lib.rs` from excluded
-: --------- > 14: 12e4efa0f Drop `lightning-background-processor/src/lib.rs` from exclusion list
.. this seems like another trivial one.
While we're here, we also drop
lightning-custom-message/src/lib.rs
from the excluded files, as it doesn't require reformatting.