Skip to content

Commit a4efc89

Browse files
committed
Add fmt::Binary constraint to BitFlagNum
Otherwise, `T: Debug` isn't enough to imply `BitFlags<T>: Debug`, and this can get in the way of code generated by #[derive(Debug)].
1 parent 6f6d797 commit a4efc89

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

enumflags/src/formatting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{BitFlags, _internal::RawBitFlags};
44
impl<T> fmt::Debug for BitFlags<T>
55
where
66
T: RawBitFlags + fmt::Debug,
7-
T::Type: fmt::Binary + fmt::Debug,
7+
T::Type: fmt::Debug,
88
{
99
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1010
let name = T::bitflags_type_name();

enumflags/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub mod _internal {
8989

9090
use core::ops::{BitAnd, BitOr, BitXor, Not};
9191
use core::cmp::PartialOrd;
92+
use core::fmt;
9293

9394
pub trait BitFlagNum
9495
: Default
@@ -97,6 +98,7 @@ pub mod _internal {
9798
+ BitXor<Self, Output = Self>
9899
+ Not<Output = Self>
99100
+ PartialOrd<Self>
101+
+ fmt::Binary
100102
+ Copy
101103
+ Clone {
102104
}

0 commit comments

Comments
 (0)