Skip to content

Commit aed8a10

Browse files
committed
Re-enable rustfmt on the lightning crate
In d257b8a we dropped our old `rustfmt` per-file exclusion logic and replaced it with `rustfmt_skip` tags in each previously-skipped files. This had the unintended consequence of fully disabling `rustfmt` across the `lightning` crate: `rustfmt` operates recursively across files in any module it is told to format. Previously, because we were running `rustfmt` on each non-excluded file, this meant we wanted to exclude `mod.rs` and `lib.rs` files - not doing so would result in the entire module/crate being formatted. However, `cargo fmt --check` only runs `rustfmt` once - on `lib.rs`. Because we added a top-level `rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and all modules. Here we resume `rustfmt`'ing the `lightning` crate by removing the `rustfmt_skip` in `lightning/src/lib.rs` (and `rustfmt`'ing `lightning/src/lib.rs`.
1 parent 0ab34bd commit aed8a10

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

lightning/src/lib.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg_attr(rustfmt, rustfmt_skip)]
2-
31
// This file is Copyright its original authors, visible in version control
42
// history.
53
//
@@ -32,18 +30,14 @@
3230
//! * `grind_signatures`
3331
3432
#![cfg_attr(not(any(test, fuzzing, feature = "_test_utils")), deny(missing_docs))]
35-
3633
#![deny(rustdoc::broken_intra_doc_links)]
3734
#![deny(rustdoc::private_intra_doc_links)]
38-
3935
// In general, rust is absolutely horrid at supporting users doing things like,
4036
// for example, compiling Rust code for real environments. Disable useless lints
4137
// that don't do anything but annoy us and cant actually ever be resolved.
4238
#![allow(bare_trait_objects)]
4339
#![allow(ellipsis_inclusive_range_patterns)]
44-
4540
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
46-
4741
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
4842

4943
#[cfg(all(fuzzing, test))]
@@ -61,24 +55,29 @@ pub extern crate lightning_invoice as bolt11_invoice;
6155
#[cfg(any(test, feature = "std"))]
6256
extern crate core;
6357

64-
#[cfg(any(test, feature = "_test_utils"))] extern crate regex;
58+
#[cfg(any(test, feature = "_test_utils"))]
59+
extern crate regex;
6560

66-
#[cfg(not(feature = "std"))] extern crate libm;
61+
#[cfg(not(feature = "std"))]
62+
extern crate libm;
6763

68-
#[cfg(ldk_bench)] extern crate criterion;
64+
#[cfg(ldk_bench)]
65+
extern crate criterion;
6966

70-
#[cfg(all(feature = "std", test))] extern crate parking_lot;
67+
#[cfg(all(feature = "std", test))]
68+
extern crate parking_lot;
7169

7270
#[macro_use]
7371
pub mod util;
72+
73+
pub mod blinded_path;
7474
pub mod chain;
75+
pub mod events;
7576
pub mod ln;
7677
pub mod offers;
78+
pub mod onion_message;
7779
pub mod routing;
7880
pub mod sign;
79-
pub mod onion_message;
80-
pub mod blinded_path;
81-
pub mod events;
8281

8382
pub(crate) mod crypto;
8483

@@ -96,7 +95,7 @@ pub mod io_extras {
9695
pub use bitcoin::io::sink;
9796

9897
pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> Result<u64, io::Error>
99-
where
98+
where
10099
R: Read,
101100
W: Write,
102101
{
@@ -106,7 +105,10 @@ pub mod io_extras {
106105
loop {
107106
match reader.read(&mut buf) {
108107
Ok(0) => break,
109-
Ok(n) => { writer.write_all(&buf[0..n])?; count += n as u64; },
108+
Ok(n) => {
109+
writer.write_all(&buf[0..n])?;
110+
count += n as u64;
111+
},
110112
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
111113
Err(e) => return Err(e.into()),
112114
};
@@ -132,7 +134,7 @@ pub mod io_extras {
132134
mod prelude {
133135
#![allow(unused_imports)]
134136

135-
pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};
137+
pub use alloc::{boxed::Box, collections::VecDeque, string::String, vec, vec::Vec};
136138

137139
pub use alloc::borrow::ToOwned;
138140
pub use alloc::string::ToString;

0 commit comments

Comments
 (0)