Skip to content

Commit 1ad2f8f

Browse files
committed
CI Improvements: min and nightly Rust, min dep version, clippy
1 parent 86e9087 commit 1ad2f8f

File tree

2 files changed

+37
-34
lines changed

2 files changed

+37
-34
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,39 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, windows-latest, macOS-latest]
20-
rust: [stable]
20+
rust: [1.77, stable, nightly]
2121

2222
steps:
2323
- uses: actions/checkout@master
2424

2525
- name: Install ${{ matrix.rust }}
26-
uses: actions-rs/toolchain@v1
27-
with:
28-
toolchain: ${{ matrix.rust }}
29-
override: true
26+
run: rustup install ${{ matrix.rust }} --component clippy
3027

31-
- name: check
32-
uses: actions-rs/cargo@v1
33-
with:
34-
command: check
35-
args: --all --bins --examples
28+
# We don't use warnings-as-errors on nightly since they can be noisy.
29+
- name: set warnings env
30+
if: ${{ matrix.rust != 'nightly' }}
31+
run: echo "RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV
3632

37-
- name: check unstable
38-
uses: actions-rs/cargo@v1
39-
with:
40-
command: check
41-
args: --all --benches --bins --examples --tests
33+
- name: clippy
34+
run: cargo +${{ matrix.rust }} clippy --all-targets --all-features -- -Dwarnings
4235

4336
- name: tests
44-
uses: actions-rs/cargo@v1
45-
with:
46-
command: test
47-
args: --all
37+
run: cargo +${{ matrix.rust }} test --workspace
38+
39+
- name: tests (minimal versions)
40+
if: ${{ matrix.rust == 'nightly' }}
41+
run: rm Cargo.lock && cargo +${{ matrix.rust }} test --workspace -Z unstable-options -Z minimal-versions
4842

4943
check_fmt_and_docs:
5044
name: Checking fmt and docs
5145
runs-on: ubuntu-latest
5246
steps:
5347
- uses: actions/checkout@master
54-
- uses: actions-rs/toolchain@v1
55-
with:
56-
toolchain: nightly
57-
components: rustfmt, clippy
58-
override: true
5948

6049
- name: fmt
6150
run: cargo fmt --all -- --check
6251

6352
- name: Docs
64-
run: cargo doc
53+
run: cargo doc --no-deps --document-private-items
54+
env:
55+
RUSTDOCFLAGS: -Dwarnings

src/iocp.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,33 +297,45 @@ mod tests {
297297
#[test]
298298
fn get() {
299299
let c = CompletionPort::new(1).unwrap();
300-
c.post(CompletionStatus::new(1, 2, std::ptr::dangling_mut()))
301-
.unwrap();
300+
c.post(CompletionStatus::new(
301+
1,
302+
2,
303+
std::ptr::NonNull::dangling().as_ptr(),
304+
))
305+
.unwrap();
302306
let s = c.get(None).unwrap();
303307
assert_eq!(s.bytes_transferred(), 1);
304308
assert_eq!(s.token(), 2);
305-
assert_eq!(s.overlapped(), std::ptr::dangling_mut());
309+
assert_eq!(s.overlapped(), std::ptr::NonNull::dangling().as_ptr());
306310
}
307311

308312
#[test]
309313
fn get_many() {
310314
let c = CompletionPort::new(1).unwrap();
311315

312-
c.post(CompletionStatus::new(1, 2, std::ptr::dangling_mut()))
313-
.unwrap();
314-
c.post(CompletionStatus::new(4, 5, std::ptr::dangling_mut()))
315-
.unwrap();
316+
c.post(CompletionStatus::new(
317+
1,
318+
2,
319+
std::ptr::NonNull::dangling().as_ptr(),
320+
))
321+
.unwrap();
322+
c.post(CompletionStatus::new(
323+
4,
324+
5,
325+
std::ptr::NonNull::dangling().as_ptr(),
326+
))
327+
.unwrap();
316328

317329
let mut s = vec![CompletionStatus::zero(); 4];
318330
{
319331
let s = c.get_many(&mut s, None).unwrap();
320332
assert_eq!(s.len(), 2);
321333
assert_eq!(s[0].bytes_transferred(), 1);
322334
assert_eq!(s[0].token(), 2);
323-
assert_eq!(s[0].overlapped(), std::ptr::dangling_mut());
335+
assert_eq!(s[0].overlapped(), std::ptr::NonNull::dangling().as_ptr());
324336
assert_eq!(s[1].bytes_transferred(), 4);
325337
assert_eq!(s[1].token(), 5);
326-
assert_eq!(s[1].overlapped(), std::ptr::dangling_mut());
338+
assert_eq!(s[1].overlapped(), std::ptr::NonNull::dangling().as_ptr());
327339
}
328340
assert_eq!(s[2].bytes_transferred(), 0);
329341
assert_eq!(s[2].token(), 0);

0 commit comments

Comments
 (0)