Skip to content

Commit b16c612

Browse files
00xcJonathanWoollett-Light
authored andcommitted
Add Copy derives where possible
Add a Copy derive to all structures that allow it for easier semantics. Copy requires Clone, so add it as well where needed. While we are at it, add the #![deny(missing_copy_implementations)] lint to prevent future additions of types that do not derive Copy when they could. Signed-off-by: Carlos López <[email protected]>
1 parent 6fdba87 commit b16c612

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

vm-superio/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Added a `reset_evt` to the `I8042Device` type to retrieve the underlying
88
reset event object.
99
- Added three methods to `Serial` to retrieve the `Write` output object.
10+
- Derived the `Copy` trait for `RtcState` and other auxiliary types.
1011

1112
# v0.7.0
1213

vm-superio/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//! that can generate an event.
1717
1818
#![deny(missing_docs)]
19+
#![deny(missing_copy_implementations)]
1920

2021
pub mod i8042;
2122
pub mod rtc_pl031;

vm-superio/src/rtc_pl031.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub trait RtcEvents {
5656
/// Provides a no-op implementation of `RtcEvents` which can be used in situations that
5757
/// do not require logging or otherwise doing anything in response to the events defined
5858
/// as part of `RtcEvents`.
59-
#[derive(Debug)]
59+
#[derive(Debug, Clone, Copy)]
6060
pub struct NoEvents;
6161

6262
impl RtcEvents for NoEvents {
@@ -140,7 +140,7 @@ pub struct Rtc<EV: RtcEvents> {
140140
}
141141

142142
/// The state of the Rtc device.
143-
#[derive(Clone, Debug, Eq, PartialEq)]
143+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
144144
pub struct RtcState {
145145
/// The load register.
146146
pub lr: u32,

vm-superio/src/serial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub trait SerialEvents {
125125
/// Provides a no-op implementation of `SerialEvents` which can be used in situations that
126126
/// do not require logging or otherwise doing anything in response to the events defined
127127
/// as part of `SerialEvents`.
128-
#[derive(Debug)]
128+
#[derive(Debug, Clone, Copy)]
129129
pub struct NoEvents;
130130

131131
impl SerialEvents for NoEvents {

0 commit comments

Comments
 (0)