Skip to content

Commit 1b97156

Browse files
authored
Merge pull request #56 from mkroening/ci-warnings
Fix warnings and deny warnings in CI
2 parents d45ab47 + 04ba536 commit 1b97156

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.github/workflows/build.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ name: Build
55
permissions:
66
contents: read
77

8+
env:
9+
RUSTFLAGS: -Dwarnings
10+
RUSTDOCFLAGS: -Dwarnings
11+
812
jobs:
913
check:
1014
name: Check
1115
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v4
1418
- uses: dtolnay/rust-toolchain@stable
15-
- run: cargo check --workspace
19+
- run: cargo check --workspace --features derive
1620

1721
test:
1822
name: Test Suite
1923
runs-on: ubuntu-latest
2024
steps:
2125
- uses: actions/checkout@v4
2226
- uses: dtolnay/rust-toolchain@stable
23-
- run: cargo test --workspace
27+
- run: cargo test --workspace --features derive
2428

2529
unstable:
2630
name: Test Suite (unstable)
@@ -47,4 +51,4 @@ jobs:
4751
with:
4852
components: clippy, rustfmt
4953
- run: cargo fmt --all --check
50-
- run: cargo clippy --workspace
54+
- run: cargo clippy --workspace --features derive

src/lib.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#![cfg_attr(feature = "very_unstable", feature(fn_traits))]
4141
#![cfg_attr(feature = "very_unstable", feature(effects))]
4242
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
43+
#![cfg_attr(feature = "unstable", allow(internal_features))]
4344
#![warn(missing_docs)]
4445
#![deny(unsafe_op_in_unsafe_fn)]
4546
#![doc(test(attr(deny(warnings))))]
@@ -62,7 +63,7 @@
6263
///
6364
/// ```
6465
/// use volatile::access::ReadOnly;
65-
/// use volatile::{VolatileFieldAccess, VolatilePtr, VolatileRef};
66+
/// use volatile::{VolatileFieldAccess, VolatileRef};
6667
///
6768
/// #[repr(C)]
6869
/// #[derive(VolatileFieldAccess, Default)]
@@ -74,7 +75,7 @@
7475
///
7576
/// let mut device_config = DeviceConfig::default();
7677
/// let mut volatile_ref = VolatileRef::from_mut_ref(&mut device_config);
77-
/// let mut volatile_ptr = volatile_ref.as_mut_ptr();
78+
/// let volatile_ptr = volatile_ref.as_mut_ptr();
7879
///
7980
/// volatile_ptr.feature_select().write(42);
8081
/// assert_eq!(volatile_ptr.feature_select().read(), 42);
@@ -92,6 +93,14 @@
9293
/// The example above results in (roughly) the following code:
9394
///
9495
/// ```
96+
/// # #[repr(C)]
97+
/// # pub struct DeviceConfig {
98+
/// # feature_select: u32,
99+
/// # feature: u32,
100+
/// # }
101+
/// use volatile::access::{ReadOnly, ReadWrite};
102+
/// use volatile::{map_field, VolatilePtr};
103+
///
95104
/// pub trait DeviceConfigVolatileFieldAccess<'a> {
96105
/// fn feature_select(self) -> VolatilePtr<'a, u32, ReadWrite>;
97106
///

src/volatile_ptr/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ where
7979
T: ?Sized,
8080
{
8181
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
82-
Some(Ord::cmp(&self.pointer.as_ptr(), &other.pointer.as_ptr()))
82+
Some(self.cmp(other))
8383
}
8484
}
8585

@@ -88,6 +88,7 @@ where
8888
T: ?Sized,
8989
{
9090
fn cmp(&self, other: &Self) -> Ordering {
91+
#[allow(ambiguous_wide_pointer_comparisons)]
9192
Ord::cmp(&self.pointer.as_ptr(), &other.pointer.as_ptr())
9293
}
9394
}

src/volatile_ref.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ where
314314
T: ?Sized,
315315
{
316316
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
317-
Some(Ord::cmp(&self.pointer.as_ptr(), &other.pointer.as_ptr()))
317+
Some(self.cmp(other))
318318
}
319319
}
320320

@@ -323,6 +323,7 @@ where
323323
T: ?Sized,
324324
{
325325
fn cmp(&self, other: &Self) -> Ordering {
326+
#[allow(ambiguous_wide_pointer_comparisons)]
326327
Ord::cmp(&self.pointer.as_ptr(), &other.pointer.as_ptr())
327328
}
328329
}

0 commit comments

Comments
 (0)