Skip to content

Commit 22a7a3d

Browse files
committed
zephyr: clippy: Add a few Default implementations
Clippy complains about implementing a zero-argument `new` function without also implementing a `Default`. Add these Default implementations to satisfy this. Signed-off-by: David Brown <[email protected]>
1 parent f13358a commit 22a7a3d

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

zephyr/src/align.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ where
4848
AlignAs([])
4949
}
5050
}
51+
52+
impl<const N: usize> Default for AlignAs<N>
53+
where
54+
AlignAsStruct: AlignAsTrait<N>,
55+
{
56+
fn default() -> Self {
57+
Self::new()
58+
}
59+
}

zephyr/src/sync/mutex.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@ impl Condvar {
238238
}
239239
}
240240

241+
#[cfg(CONFIG_RUST_ALLOC)]
242+
impl Default for Condvar {
243+
fn default() -> Self {
244+
Self::new()
245+
}
246+
}
247+
241248
impl fmt::Debug for Condvar {
242249
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
243250
write!(f, "Condvar {:?}", self.inner)

zephyr/src/timer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ impl fmt::Debug for StoppedTimer {
136136
}
137137
}
138138

139+
impl Default for StoppedTimer {
140+
fn default() -> Self {
141+
Self::new()
142+
}
143+
}
144+
139145
/// A statically allocated `k_timer` (StoppedTimer).
140146
///
141147
/// This is intended to be used from within the `kobj_define!` macro. It declares a static

0 commit comments

Comments
 (0)