Skip to content

Commit 9779572

Browse files
committed
Format modules defined inside macros
`cargo fmt` cannot recognize modules defined inside macros.
1 parent 692fc79 commit 9779572

File tree

29 files changed

+545
-668
lines changed

29 files changed

+545
-668
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ jobs:
243243
# rustup component add clippy
244244
# - run: cargo clippy --workspace --all-features --all-targets
245245

246-
rustfmt:
246+
fmt:
247247
runs-on: ubuntu-latest
248248
steps:
249249
- uses: actions/checkout@v2
250250
- name: Install Rust
251251
run: rustup update stable && rustup default stable
252-
- run: cargo fmt --all -- --check
252+
- run: tools/fmt.sh
253253

254254
docs:
255255
name: cargo doc

.rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
use_small_heuristics = "Max"
2+
edition = "2018"

futures-channel/src/lock.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
77
use core::cell::UnsafeCell;
88
use core::ops::{Deref, DerefMut};
9-
use core::sync::atomic::Ordering::SeqCst;
109
use core::sync::atomic::AtomicBool;
10+
use core::sync::atomic::Ordering::SeqCst;
1111

1212
/// A "mutex" around a value, similar to `std::sync::Mutex<T>`.
1313
///
@@ -37,10 +37,7 @@ unsafe impl<T: Send> Sync for Lock<T> {}
3737
impl<T> Lock<T> {
3838
/// Creates a new lock around the given value.
3939
pub(crate) fn new(t: T) -> Self {
40-
Self {
41-
locked: AtomicBool::new(false),
42-
data: UnsafeCell::new(t),
43-
}
40+
Self { locked: AtomicBool::new(false), data: UnsafeCell::new(t) }
4441
}
4542

4643
/// Attempts to acquire this lock, returning whether the lock was acquired or

0 commit comments

Comments
 (0)