@@ -78,7 +78,7 @@ impl unicode_bidi::BidiDataSource for CompositePropsV1Data<'_> {
7878
7979/// Unicode character properties relevant for text analysis.
8080#[ derive( Copy , Clone , Debug , Eq , PartialEq , yoke:: Yokeable , ZeroFrom ) ]
81- #[ cfg_attr( feature = "datagen" , derive( databake:: Bake ) ) ]
81+ #[ cfg_attr( feature = "datagen" , derive( databake:: Bake , Default ) ) ]
8282#[ cfg_attr( feature = "datagen" , databake( path = properties_marker) ) ]
8383pub struct Properties ( u32 ) ;
8484
@@ -171,6 +171,10 @@ impl Properties {
171171 /// Returns the bidirectional class for the character.
172172 #[ inline( always) ]
173173 pub fn bidi_class ( & self ) -> unicode_bidi:: BidiClass {
174+ #[ allow(
175+ clippy:: cast_possible_truncation,
176+ reason = "bidi class data only occupies BIDI_BITS bits."
177+ ) ]
174178 match self . get ( Self :: BIDI_SHIFT , Self :: BIDI_BITS ) as u8 {
175179 0 => unicode_bidi:: BidiClass :: AL ,
176180 1 => unicode_bidi:: BidiClass :: AN ,
@@ -256,13 +260,6 @@ impl Properties {
256260 }
257261}
258262
259- #[ cfg( feature = "datagen" ) ]
260- impl Default for Properties {
261- fn default ( ) -> Self {
262- Self ( 0 )
263- }
264- }
265-
266263impl From < Properties > for u32 {
267264 fn from ( value : Properties ) -> Self {
268265 value. 0
@@ -275,14 +272,14 @@ impl zerovec::ule::AsULE for Properties {
275272 self . 0 . into ( )
276273 }
277274 fn from_unaligned ( unaligned : Self :: ULE ) -> Self {
278- Properties ( u32:: from_le_bytes ( unaligned. 0 ) )
275+ Self ( u32:: from_le_bytes ( unaligned. 0 ) )
279276 }
280277}
281278
282279impl TrieValue for Properties {
283280 type TryFromU32Error = TryFromIntError ;
284281 fn try_from_u32 ( i : u32 ) -> Result < Self , Self :: TryFromU32Error > {
285- Ok ( Properties ( i) )
282+ Ok ( Self ( i) )
286283 }
287284 fn to_u32 ( self ) -> u32 {
288285 self . 0
@@ -295,7 +292,7 @@ impl<'de> serde::Deserialize<'de> for Properties {
295292 D : serde:: Deserializer < ' de > ,
296293 {
297294 let value = u32:: deserialize ( deserializer) ?;
298- Ok ( Properties ( value) )
295+ Ok ( Self ( value) )
299296 }
300297}
301298
0 commit comments