Skip to content

Commit

Permalink
Restrict ADC ID type to Copy types
Browse files Browse the repository at this point in the history
This fixes a deny-by-default clippy lint:

```
error: a `const` item should never be interior mutable
  --> src/adc.rs:47:5
   |
47 |     const CHANNEL: Self::ID;
   |     ^^^^^^^^^^^^^^^--------^
   |                    |
   |                    consider requiring `<Self as adc::Channel<ADC>>::ID` to be `Copy`
   |
   = note: `#[deny(clippy::declare_interior_mutable_const)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#declare_interior_mutable_const
```

Signed-off-by: Daniel Egger <[email protected]>
  • Loading branch information
therealprof committed Jun 2, 2020
1 parent 181d44b commit 4a5f512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait Channel<ADC> {
/// A type used to identify this ADC channel. For example, if the ADC has eight channels, this
/// might be a `u8`. If the ADC has multiple banks of channels, it could be a tuple, like
/// `(u8: bank_id, u8: channel_id)`.
type ID;
type ID: Copy;

/// Get the specific ID that identifies this channel, for example `0_u8` for the first ADC
/// channel, if Self::ID is u8.
Expand Down

0 comments on commit 4a5f512

Please sign in to comment.