Skip to content

Commit 12aeefa

Browse files
fix: a lot of things that do not work (#3)
* ci: fix wrong branch name * ci: use ubuntu-latest * fix: and bilock feature, fix compile error * chore: fix clippy warnings * feat: trim down flake --------- Co-authored-by: George Miao <gm@miao.dev>
1 parent f068e3e commit 12aeefa

9 files changed

Lines changed: 41 additions & 39 deletions

File tree

.github/workflows/ci_check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name: Check
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
paths:
88
- "Cargo.toml"
99
- "**/*.rs"
1010
- ".github/workflows/ci_check.yml"
1111
pull_request:
1212
branches:
13-
- master
13+
- main
1414
paths:
1515
- "Cargo.toml"
1616
- "**/*.rs"
@@ -25,7 +25,7 @@ env:
2525

2626
jobs:
2727
check:
28-
runs-on: ubuntu-22.04
28+
runs-on: ubuntu-latest
2929
steps:
3030
- uses: actions/checkout@v4
3131
- name: Setup Rust Toolchain

.github/workflows/ci_check_minimal.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name: Check (Minimal Versions)
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
paths:
88
- "Cargo.toml"
99
- "**/*.rs"
1010
- ".github/workflows/ci_check_minimal.yml"
1111
pull_request:
1212
branches:
13-
- master
13+
- main
1414
paths:
1515
- "Cargo.toml"
1616
- "**/*.rs"
@@ -25,7 +25,7 @@ env:
2525

2626
jobs:
2727
check:
28-
runs-on: ubuntu-22.04
28+
runs-on: ubuntu-latest
2929
steps:
3030
- uses: actions/checkout@v4
3131
- name: Setup Rust Toolchain

.github/workflows/ci_format.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: Check Code Format
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
paths:
88
- "rustfmt.toml"
99
- "Cargo.toml"
1010
- "**/*.rs"
1111
- ".github/workflows/ci_format.yml"
1212
pull_request:
1313
branches:
14-
- master
14+
- main
1515
paths:
1616
- "rustfmt.toml"
1717
- "**/*.rs"
@@ -22,7 +22,7 @@ env:
2222

2323
jobs:
2424
check:
25-
runs-on: ubuntu-22.04
25+
runs-on: ubuntu-latest
2626
steps:
2727
- uses: actions/checkout@v4
2828
- name: Setup Rust Toolchain

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ watch = ["dep:see"]
2323
mutex = ["dep:futures", "dep:slab", "futures?/std"]
2424
waker_slot = ["dep:futures"]
2525
event = ["dep:event-listener", "dep:local-event"]
26+
bilock = ["waker_slot"]
2627

2728
[dev-dependencies]
2829
futures = { version = "0.3.31", features = ["executor"] }

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
{
2828
devShells.default = mkShell {
2929
buildInputs = [
30-
go
31-
cmake
32-
glib
33-
lldb
34-
openssl
35-
pkg-config
3630
(rust-bin.selectLatestNightlyWith (
3731
toolchain:
3832
toolchain.default.override {

src/atomic/unsync.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::{
2-
cell::Cell,
3-
fmt::{Debug, Display},
4-
sync::atomic::Ordering,
5-
};
1+
use std::{cell::Cell, fmt::Debug, sync::atomic::Ordering};
62

73
atomic_int!(AtomicU8(u8));
84
atomic_int!(AtomicU16(u16));

src/lib.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@
4141
#![warn(missing_docs)]
4242
#![deny(rustdoc::broken_intra_doc_links)]
4343

44+
#[cfg(feature = "bilock")]
45+
mod bilock;
46+
#[cfg(feature = "event")]
47+
mod event;
4448
#[cfg(feature = "mutex")]
4549
mod mutex;
46-
4750
#[cfg(feature = "waker_slot")]
4851
mod waker_slot;
4952

50-
#[cfg(feature = "event")]
51-
mod event;
52-
5353
mod atomic;
54-
mod bilock;
5554
mod flag;
5655
mod mutex_blocking;
5756
mod shared;
@@ -63,6 +62,12 @@ pub mod sync {
6362
#[cfg(feature = "watch")]
6463
pub use see::sync as watch;
6564

65+
#[doc(inline)]
66+
#[cfg(feature = "bilock")]
67+
pub use crate::bilock::sync as bilock;
68+
#[doc(inline)]
69+
#[cfg(feature = "event")]
70+
pub use crate::event::sync as event;
6671
#[doc(inline)]
6772
#[cfg(feature = "mutex")]
6873
pub use crate::mutex::sync as mutex;
@@ -71,8 +76,8 @@ pub mod sync {
7176
pub use crate::waker_slot::sync as waker_slot;
7277
#[doc(inline)]
7378
pub use crate::{
74-
atomic::sync as atomic, bilock::sync as bilock, event::sync as event, flag::sync as flag,
75-
mutex_blocking::sync as mutex_blocking, shared::sync as shared,
79+
atomic::sync as atomic, flag::sync as flag, mutex_blocking::sync as mutex_blocking,
80+
shared::sync as shared,
7681
};
7782
}
7883

@@ -83,6 +88,12 @@ pub mod unsync {
8388
#[cfg(feature = "watch")]
8489
pub use see::unsync as watch;
8590

91+
#[doc(inline)]
92+
#[cfg(feature = "bilock")]
93+
pub use crate::bilock::unsync as bilock;
94+
#[doc(inline)]
95+
#[cfg(feature = "event")]
96+
pub use crate::event::unsync as event;
8697
#[doc(inline)]
8798
#[cfg(feature = "mutex")]
8899
pub use crate::mutex::unsync as mutex;
@@ -91,8 +102,8 @@ pub mod unsync {
91102
pub use crate::waker_slot::unsync as waker_slot;
92103
#[doc(inline)]
93104
pub use crate::{
94-
atomic::unsync as atomic, bilock::unsync as bilock, event::unsync as event,
95-
flag::unsync as flag, mutex_blocking::unsync as mutex_blocking, shared::unsync as shared,
105+
atomic::unsync as atomic, flag::unsync as flag, mutex_blocking::unsync as mutex_blocking,
106+
shared::unsync as shared,
96107
};
97108
}
98109

src/mutex_blocking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ pub mod sync {
5454
type Target = T;
5555

5656
fn deref(&self) -> &Self::Target {
57-
&*self.0
57+
&self.0
5858
}
5959
}
6060

6161
impl<'a, T> DerefMut for MutexGuard<'a, T> {
6262
fn deref_mut(&mut self) -> &mut Self::Target {
63-
&mut *self.0
63+
&mut self.0
6464
}
6565
}
6666

@@ -118,13 +118,13 @@ pub mod unsync {
118118
type Target = T;
119119

120120
fn deref(&self) -> &Self::Target {
121-
&*self.0
121+
&self.0
122122
}
123123
}
124124

125125
impl<'a, T> DerefMut for MutexGuard<'a, T> {
126126
fn deref_mut(&mut self) -> &mut Self::Target {
127-
&mut *self.0
127+
&mut self.0
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)