Skip to content

Commit

Permalink
Format modules defined inside macros
Browse files Browse the repository at this point in the history
`cargo fmt` cannot recognize modules defined inside macros.
  • Loading branch information
taiki-e committed May 7, 2021
1 parent 692fc79 commit 9779572
Show file tree
Hide file tree
Showing 29 changed files with 545 additions and 668 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ jobs:
# rustup component add clippy
# - run: cargo clippy --workspace --all-features --all-targets

rustfmt:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable && rustup default stable
- run: cargo fmt --all -- --check
- run: tools/fmt.sh

docs:
name: cargo doc
Expand Down
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
use_small_heuristics = "Max"
edition = "2018"
7 changes: 2 additions & 5 deletions futures-channel/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use core::cell::UnsafeCell;
use core::ops::{Deref, DerefMut};
use core::sync::atomic::Ordering::SeqCst;
use core::sync::atomic::AtomicBool;
use core::sync::atomic::Ordering::SeqCst;

/// A "mutex" around a value, similar to `std::sync::Mutex<T>`.
///
Expand Down Expand Up @@ -37,10 +37,7 @@ unsafe impl<T: Send> Sync for Lock<T> {}
impl<T> Lock<T> {
/// Creates a new lock around the given value.
pub(crate) fn new(t: T) -> Self {
Self {
locked: AtomicBool::new(false),
data: UnsafeCell::new(t),
}
Self { locked: AtomicBool::new(false), data: UnsafeCell::new(t) }
}

/// Attempts to acquire this lock, returning whether the lock was acquired or
Expand Down
Loading

0 comments on commit 9779572

Please sign in to comment.