@@ -131,7 +131,7 @@ impl fmt::Display for Script {
131
131
}
132
132
}
133
133
134
- #[ derive( Clone , Copy , PartialEq , Eq , Hash ) ]
134
+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug ) ]
135
135
#[ non_exhaustive]
136
136
/// A value for the `Script_Extension` property
137
137
///
@@ -311,33 +311,23 @@ impl From<&'_ str> for ScriptExtension {
311
311
}
312
312
}
313
313
314
- impl fmt:: Debug for ScriptExtension {
315
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
316
- write ! ( f, "ScriptExtension(" ) ?;
317
- fmt:: Display :: fmt ( self , f) ?;
318
- write ! ( f, ")" )
319
- }
320
- }
321
-
322
314
impl fmt:: Display for ScriptExtension {
323
315
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
324
- if self . is_common ( ) {
325
- write ! ( f, "Common" ) ?;
326
- } else if self . is_inherited ( ) {
327
- write ! ( f, "Inherited" ) ?;
328
- } else if self . is_empty ( ) {
316
+ write ! ( f, "ScriptExtension(" ) ?;
317
+ if self . is_empty ( ) {
329
318
write ! ( f, "Unknown" ) ?;
330
319
} else {
331
320
let mut first = true ;
332
321
for script in self . iter ( ) {
333
- if !first {
334
- write ! ( f, " + " ) ?;
322
+ if first {
335
323
first = false ;
324
+ } else {
325
+ write ! ( f, " + " ) ?;
336
326
}
337
327
script. full_name ( ) . fmt ( f) ?;
338
328
}
339
329
}
340
- Ok ( ( ) )
330
+ write ! ( f , ")" )
341
331
}
342
332
}
343
333
@@ -361,7 +351,7 @@ impl UnicodeScript for char {
361
351
362
352
/// Iterator over scripts in a [ScriptExtension].
363
353
///
364
- /// Can be obtained ia [ScriptExtension::iter()]
354
+ /// Can be obtained via [ScriptExtension::iter()]
365
355
pub struct ScriptIterator {
366
356
ext : ScriptExtension ,
367
357
}
@@ -445,11 +435,11 @@ mod tests {
445
435
let ext = ScriptExtension :: for_str ( s) ;
446
436
assert_eq ! ( ext, script_extensions:: DEVA ) ;
447
437
println ! (
448
- "{:? }" ,
438
+ "{}" ,
449
439
script_extensions:: DEVA_DOGR_GUJR_GURU_KHOJ_KTHI_MAHJ_MODI_SIND_TAKR_TIRH
450
440
) ;
451
441
println ! (
452
- "{:? }" ,
442
+ "{}" ,
453
443
ext. intersection(
454
444
script_extensions:: DEVA_DOGR_GUJR_GURU_KHOJ_KTHI_MAHJ_MODI_SIND_TAKR_TIRH
455
445
)
0 commit comments