Skip to content

Commit 5691066

Browse files
committed
Format modules defined inside macros
`cargo fmt` cannot recognize modules defined inside macros.
1 parent f5ec363 commit 5691066

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
@@ -241,13 +241,13 @@ jobs:
241241
rustup component add clippy
242242
- run: cargo clippy --workspace --all-features --all-targets
243243

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

252252
docs:
253253
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)