@@ -146,6 +146,7 @@ pub trait BitFlag: Copy + Clone + 'static + _internal::RawBitFlags {
146146 /// assert_eq!(empty.contains(MyFlag::Two), false);
147147 /// assert_eq!(empty.contains(MyFlag::Three), false);
148148 /// ```
149+ #[ inline]
149150 fn empty ( ) -> BitFlags < Self > {
150151 BitFlags :: empty ( )
151152 }
@@ -174,6 +175,7 @@ pub trait BitFlag: Copy + Clone + 'static + _internal::RawBitFlags {
174175 /// assert_eq!(empty.contains(MyFlag::Two), true);
175176 /// assert_eq!(empty.contains(MyFlag::Three), true);
176177 /// ```
178+ #[ inline]
177179 fn all ( ) -> BitFlags < Self > {
178180 BitFlags :: all ( )
179181 }
@@ -421,6 +423,7 @@ where
421423{
422424 /// Returns a `BitFlags<T>` if the raw value provided does not contain
423425 /// any illegal flags.
426+ #[ inline]
424427 pub fn from_bits ( bits : T :: Numeric ) -> Result < Self , FromBitsError < T > > {
425428 let flags = Self :: from_bits_truncate ( bits) ;
426429 if flags. bits ( ) == bits {
@@ -435,6 +438,7 @@ where
435438
436439 /// Create a `BitFlags<T>` from an underlying bitwise value. If any
437440 /// invalid bits are set, ignore them.
441+ #[ must_use]
438442 #[ inline( always) ]
439443 pub fn from_bits_truncate ( bits : T :: Numeric ) -> Self {
440444 unsafe { BitFlags :: from_bits_unchecked ( bits & T :: ALL_BITS ) }
@@ -450,6 +454,7 @@ where
450454 ///
451455 /// The argument must not have set bits at positions not corresponding to
452456 /// any flag.
457+ #[ must_use]
453458 #[ inline( always) ]
454459 pub unsafe fn from_bits_unchecked ( val : T :: Numeric ) -> Self {
455460 BitFlags {
@@ -459,6 +464,7 @@ where
459464 }
460465
461466 /// Turn a `T` into a `BitFlags<T>`. Also available as `flag.into()`.
467+ #[ must_use]
462468 #[ inline( always) ]
463469 pub fn from_flag ( flag : T ) -> Self {
464470 unsafe { Self :: from_bits_unchecked ( flag. bits ( ) ) }
@@ -601,6 +607,7 @@ where
601607 }
602608
603609 /// Returns an iterator that yields each set flag
610+ #[ inline]
604611 pub fn iter ( self ) -> impl Iterator < Item = T > + Clone {
605612 T :: FLAG_LIST
606613 . iter ( )
@@ -624,6 +631,7 @@ for_each_uint! { $ty $hide_docs =>
624631 ///
625632 /// The argument must not have set bits at positions not corresponding to
626633 /// any flag.
634+ #[ must_use]
627635 #[ inline( always) ]
628636 $( #[ $hide_docs] ) ?
629637 pub const unsafe fn from_bits_unchecked_c(
@@ -654,6 +662,7 @@ for_each_uint! { $ty $hide_docs =>
654662 /// BitFlags::<MyFlag>::from_bits_truncate_c(0b10101010, BitFlags::CONST_TOKEN);
655663 /// assert_eq!(FLAGS, MyFlag::Two);
656664 /// ```
665+ #[ must_use]
657666 #[ inline( always) ]
658667 $( #[ $hide_docs] ) ?
659668 pub const fn from_bits_truncate_c(
@@ -716,6 +725,7 @@ for_each_uint! { $ty $hide_docs =>
716725 /// const NEGATED: BitFlags<MyFlag> = FLAGS.not_c(BitFlags::CONST_TOKEN);
717726 /// assert_eq!(NEGATED, MyFlag::Three);
718727 /// ```
728+ #[ must_use]
719729 #[ inline( always) ]
720730 $( #[ $hide_docs] ) ?
721731 pub const fn not_c( self , const_token: ConstToken <T , $ty>) -> Self {
@@ -845,6 +855,7 @@ where
845855 T : BitFlag ,
846856 B : Into < BitFlags < T > > ,
847857{
858+ #[ inline]
848859 fn from_iter < I > ( it : I ) -> BitFlags < T >
849860 where
850861 I : IntoIterator < Item = B > ,
@@ -859,6 +870,7 @@ where
859870 T : BitFlag ,
860871 B : Into < BitFlags < T > > ,
861872{
873+ #[ inline]
862874 fn extend < I > ( & mut self , it : I )
863875 where
864876 I : IntoIterator < Item = B > ,
0 commit comments