@@ -13,7 +13,7 @@ use super::{UnicodeWidthChar, UnicodeWidthStr};
1313#[ cfg( feature ="bench" ) ]
1414use std:: iter;
1515#[ cfg( feature ="bench" ) ]
16- use test:: { self , Bencher } ;
16+ use test:: Bencher ;
1717
1818use std:: prelude:: v1:: * ;
1919
@@ -93,15 +93,15 @@ fn simple_width_match(c: char) -> Option<usize> {
9393 _ =>UnicodeWidthChar :: width ( c) ,
9494}
9595}
96- #[ cfg( all ( feature ="bench" , not ( feature = "no_std" ) ) ) ]
96+ #[ cfg( feature ="bench" ) ]
9797#[ bench]
9898fn enwik8 ( b : & mut Bencher ) {
9999// To benchmark, download & unzip `enwik8` from https://data.deepai.org/enwik8.zip
100100let data_path ="bench_data/enwik8" ;
101101let string = std:: fs:: read_to_string ( data_path) . unwrap_or_default ( ) ;
102102 b. iter ( || test:: black_box ( UnicodeWidthStr :: width ( string. as_str ( ) ) ) ) ;
103103}
104- #[ cfg( all ( feature ="bench" , not ( feature = "no_std" ) ) ) ]
104+ #[ cfg( feature ="bench" ) ]
105105#[ bench]
106106fn jawiki ( b : & mut Bencher ) {
107107// To benchmark, download & extract `jawiki-20220501-pages-articles-multistream-index.txt` from
@@ -140,8 +140,6 @@ fn test_emoji() {
140140#[ test]
141141fn test_char ( ) {
142142use super :: UnicodeWidthChar ;
143- #[ cfg( feature ="no_std" ) ]
144- use core:: option:: Option :: { None , Some } ;
145143
146144assert_eq ! ( UnicodeWidthChar :: width( 'h' ) , Some ( 2 ) ) ;
147145assert_eq ! ( 'h' . width_cjk( ) , Some ( 2 ) ) ;
@@ -156,8 +154,6 @@ fn test_char() {
156154#[ test]
157155fn test_char2 ( ) {
158156use super :: UnicodeWidthChar ;
159- #[ cfg( feature ="no_std" ) ]
160- use core:: option:: Option :: { None , Some } ;
161157
162158assert_eq ! ( UnicodeWidthChar :: width( '\x00' ) , Some ( 0 ) ) ;
163159assert_eq ! ( '\x00' . width_cjk( ) , Some ( 0 ) ) ;
@@ -187,17 +183,13 @@ fn test_char2() {
187183#[ test]
188184fn unicode_12 ( ) {
189185use super :: UnicodeWidthChar ;
190- #[ cfg( feature ="no_std" ) ]
191- use core:: option:: Option :: { None , Some } ;
192186
193187assert_eq ! ( UnicodeWidthChar :: width( '\u{1F971}' ) , Some ( 2 ) ) ;
194188}
195189
196190#[ test]
197191fn test_default_ignorable ( ) {
198192use super :: UnicodeWidthChar ;
199- #[ cfg( feature ="no_std" ) ]
200- use core:: option:: Option :: { None , Some } ;
201193
202194assert_eq ! ( UnicodeWidthChar :: width( '\u{E0000}' ) , Some ( 0 ) ) ;
203195
@@ -209,8 +201,6 @@ fn test_default_ignorable() {
209201#[ test]
210202fn test_jamo ( ) {
211203use super :: UnicodeWidthChar ;
212- #[ cfg( feature ="no_std" ) ]
213- use core:: option:: Option :: { None , Some } ;
214204
215205assert_eq ! ( UnicodeWidthChar :: width( '\u{1100}' ) , Some ( 2 ) ) ;
216206assert_eq ! ( UnicodeWidthChar :: width( '\u{A97C}' ) , Some ( 2 ) ) ;
@@ -225,8 +215,6 @@ fn test_jamo() {
225215#[ test]
226216fn test_prepended_concatenation_marks ( ) {
227217use super :: UnicodeWidthChar ;
228- #[ cfg( feature ="no_std" ) ]
229- use core:: option:: Option :: { None , Some } ;
230218
231219assert_eq ! ( UnicodeWidthChar :: width( '\u{0600}' ) , Some ( 1 ) ) ;
232220assert_eq ! ( UnicodeWidthChar :: width( '\u{070F}' ) , Some ( 1 ) ) ;
@@ -237,8 +225,6 @@ fn test_prepended_concatenation_marks() {
237225#[ test]
238226fn test_interlinear_annotation_chars ( ) {
239227use super :: UnicodeWidthChar ;
240- #[ cfg( feature ="no_std" ) ]
241- use core:: option:: Option :: { None , Some } ;
242228
243229assert_eq ! ( UnicodeWidthChar :: width( '\u{FFF9}' ) , Some ( 1 ) ) ;
244230assert_eq ! ( UnicodeWidthChar :: width( '\u{FFFA}' ) , Some ( 1 ) ) ;
@@ -248,8 +234,6 @@ fn test_interlinear_annotation_chars() {
248234#[ test]
249235fn test_hieroglyph_format_controls ( ) {
250236use super :: UnicodeWidthChar ;
251- #[ cfg( feature ="no_std" ) ]
252- use core:: option:: Option :: { None , Some } ;
253237
254238assert_eq ! ( UnicodeWidthChar :: width( '\u{13430}' ) , Some ( 1 ) ) ;
255239assert_eq ! ( UnicodeWidthChar :: width( '\u{13436}' ) , Some ( 1 ) ) ;