Skip to content
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

Add rustfmt check to CI #2421

Merged
merged 2 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ jobs:
rustup component add clippy
- run: cargo clippy --workspace --all-features --all-targets

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

docs:
name: cargo doc
runs-on: ubuntu-latest
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