Skip to content

Commit ae4cb33

Browse files
committed
Make errors public
1 parent b283bc8 commit ae4cb33

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4949
which resulted into the situtation, that BSD 0-clause was not affectivly
5050
0-clause as MIT conditions had to be met anyways. (🧂 IANAL). ([#309])
5151
- Renamed `Serial::raw_read` to `Serial::read_data_register`. ([#281])
52-
- Timer error type `AlreadyCancled` is no longer public constructable. ([#281])
5352
- Seal `FlashExt` and `RccExt` traits. These are no longer implementable by
5453
a user of this crate. ([#281])
5554
- Move ADC from a macro to a generic implementation, meaning that

src/adc/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl TryFrom<u8> for Id {
125125
16 => Id::Sixteen,
126126
17 => Id::Seventeen,
127127
18 => Id::Eighteen,
128-
_ => return Err(crate::TryFromIntError(())),
128+
_ => return Err(crate::TryFromIntError),
129129
})
130130
}
131131
}

src/adc/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl TryFrom<u8> for Sequence {
116116
13 => Sequence::Fourteen,
117117
14 => Sequence::Fifteen,
118118
15 => Sequence::Sixteen,
119-
_ => return Err(crate::TryFromIntError(())),
119+
_ => return Err(crate::TryFromIntError),
120120
})
121121
}
122122
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,4 @@ impl From<bool> for Toggle {
299299
/// in multiple occasions inside this crate.
300300
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
301301
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
302-
pub struct TryFromIntError(pub(crate) ());
302+
pub struct TryFromIntError;

src/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ where
323323
/// Error if a [`Cancel`]-ble [`Timer`] was cancled already or never been started.
324324
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
325325
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
326-
pub struct AlreadyCancled(pub(crate) ());
326+
pub struct AlreadyCancled;
327327

328328
impl<TIM> Cancel for Timer<TIM>
329329
where
@@ -333,7 +333,7 @@ where
333333
fn cancel(&mut self) -> Result<(), Self::Error> {
334334
// If timer is already stopped.
335335
if !self.tim.is_cr1_cen_set() {
336-
return Err(AlreadyCancled(()));
336+
return Err(AlreadyCancled);
337337
}
338338
self.stop();
339339
Ok(())

testsuite/tests/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ mod tests {
120120
timer.start(10.milliseconds());
121121
state.delay.delay_ms(5u32);
122122

123-
assert!(matches!(timer.cancel(), Ok(())));
124-
assert!(matches!(timer.cancel(), Err(AlreadyCancled)));
123+
assert_eq!(timer.cancel(), Ok(()));
124+
assert_eq!(timer.cancel(), Err(AlreadyCancled));
125125
state.timer = Some(timer);
126126
}
127127

0 commit comments

Comments
 (0)