@@ -160,15 +160,15 @@ fn load_data() -> UnicodeData {
160
160
. push ( Codepoints :: Single ( row. codepoint ) ) ;
161
161
}
162
162
163
- if let Some ( mapped) = row. simple_lowercase_mapping {
164
- if mapped != row. codepoint {
165
- to_lower . insert ( row . codepoint . value ( ) , ( mapped . value ( ) , 0 , 0 ) ) ;
166
- }
163
+ if let Some ( mapped) = row. simple_lowercase_mapping
164
+ && mapped != row. codepoint
165
+ {
166
+ to_lower . insert ( row . codepoint . value ( ) , ( mapped . value ( ) , 0 , 0 ) ) ;
167
167
}
168
- if let Some ( mapped) = row. simple_uppercase_mapping {
169
- if mapped != row. codepoint {
170
- to_upper . insert ( row . codepoint . value ( ) , ( mapped . value ( ) , 0 , 0 ) ) ;
171
- }
168
+ if let Some ( mapped) = row. simple_uppercase_mapping
169
+ && mapped != row. codepoint
170
+ {
171
+ to_upper . insert ( row . codepoint . value ( ) , ( mapped . value ( ) , 0 , 0 ) ) ;
172
172
}
173
173
}
174
174
@@ -196,12 +196,12 @@ fn load_data() -> UnicodeData {
196
196
. flat_map ( |codepoints| match codepoints {
197
197
Codepoints :: Single ( c) => c
198
198
. scalar ( )
199
- . map ( |ch| ( ch as u32 ..ch as u32 + 1 ) )
199
+ . map ( |ch| ch as u32 ..ch as u32 + 1 )
200
200
. into_iter ( )
201
201
. collect :: < Vec < _ > > ( ) ,
202
202
Codepoints :: Range ( c) => c
203
203
. into_iter ( )
204
- . flat_map ( |c| c. scalar ( ) . map ( |ch| ( ch as u32 ..ch as u32 + 1 ) ) )
204
+ . flat_map ( |c| c. scalar ( ) . map ( |ch| ch as u32 ..ch as u32 + 1 ) )
205
205
. collect :: < Vec < _ > > ( ) ,
206
206
} )
207
207
. collect :: < Vec < Range < u32 > > > ( ) ,
@@ -236,7 +236,7 @@ fn main() {
236
236
let ranges_by_property = & unicode_data. ranges ;
237
237
238
238
if let Some ( path) = test_path {
239
- std:: fs:: write ( & path, generate_tests ( & write_location, & ranges_by_property) ) . unwrap ( ) ;
239
+ std:: fs:: write ( & path, generate_tests ( & write_location, ranges_by_property) ) . unwrap ( ) ;
240
240
}
241
241
242
242
let mut total_bytes = 0 ;
@@ -246,9 +246,9 @@ fn main() {
246
246
247
247
let mut emitter = RawEmitter :: new ( ) ;
248
248
if property == & "White_Space" {
249
- emit_whitespace ( & mut emitter, & ranges) ;
249
+ emit_whitespace ( & mut emitter, ranges) ;
250
250
} else {
251
- emit_codepoints ( & mut emitter, & ranges) ;
251
+ emit_codepoints ( & mut emitter, ranges) ;
252
252
}
253
253
254
254
modules. push ( ( property. to_lowercase ( ) . to_string ( ) , emitter. file ) ) ;
@@ -288,7 +288,7 @@ fn main() {
288
288
for line in contents. lines ( ) {
289
289
if !line. trim ( ) . is_empty ( ) {
290
290
table_file. push_str ( " " ) ;
291
- table_file. push_str ( & line) ;
291
+ table_file. push_str ( line) ;
292
292
}
293
293
table_file. push ( '\n' ) ;
294
294
}
@@ -312,15 +312,15 @@ fn version() -> String {
312
312
let start = readme. find ( prefix) . unwrap ( ) + prefix. len ( ) ;
313
313
let end = readme. find ( " of the Unicode Standard." ) . unwrap ( ) ;
314
314
let version =
315
- readme[ start..end] . split ( '.' ) . map ( |v| v. parse :: < u32 > ( ) . expect ( & v) ) . collect :: < Vec < _ > > ( ) ;
315
+ readme[ start..end] . split ( '.' ) . map ( |v| v. parse :: < u32 > ( ) . expect ( v) ) . collect :: < Vec < _ > > ( ) ;
316
316
let [ major, minor, micro] = [ version[ 0 ] , version[ 1 ] , version[ 2 ] ] ;
317
317
318
318
out. push_str ( & format ! ( "({major}, {minor}, {micro});\n " ) ) ;
319
319
out
320
320
}
321
321
322
322
fn fmt_list < V : std:: fmt:: Debug > ( values : impl IntoIterator < Item = V > ) -> String {
323
- let pieces = values. into_iter ( ) . map ( |b| format ! ( "{:?}, " , b ) ) . collect :: < Vec < _ > > ( ) ;
323
+ let pieces = values. into_iter ( ) . map ( |b| format ! ( "{b :?}, " ) ) . collect :: < Vec < _ > > ( ) ;
324
324
let mut out = String :: new ( ) ;
325
325
let mut line = String :: from ( "\n " ) ;
326
326
for piece in pieces {
@@ -348,7 +348,7 @@ fn generate_tests(data_path: &str, ranges: &[(&str, Vec<Range<u32>>)]) -> String
348
348
s. push_str ( "\n fn main() {\n " ) ;
349
349
350
350
for ( property, ranges) in ranges {
351
- s. push_str ( & format ! ( r#" println!("Testing {}");"# , property ) ) ;
351
+ s. push_str ( & format ! ( r#" println!("Testing {property }");"# ) ) ;
352
352
s. push ( '\n' ) ;
353
353
s. push_str ( & format ! ( " {}_true();\n " , property. to_lowercase( ) ) ) ;
354
354
s. push_str ( & format ! ( " {}_false();\n " , property. to_lowercase( ) ) ) ;
@@ -373,7 +373,7 @@ fn generate_tests(data_path: &str, ranges: &[(&str, Vec<Range<u32>>)]) -> String
373
373
s. push_str ( " }\n \n " ) ;
374
374
}
375
375
376
- s. push_str ( "}" ) ;
376
+ s. push ( '}' ) ;
377
377
s
378
378
}
379
379
@@ -388,7 +388,7 @@ fn generate_asserts(s: &mut String, property: &str, points: &[u32], truthy: bool
388
388
range. start,
389
389
) ) ;
390
390
} else {
391
- s. push_str ( & format ! ( " for chn in {:?}u32 {{\n " , range ) ) ;
391
+ s. push_str ( & format ! ( " for chn in {range :?}u32 {{\n " ) ) ;
392
392
s. push_str ( & format ! (
393
393
" assert!({}unicode_data::{}::lookup(std::char::from_u32(chn).unwrap()), \" {{:?}}\" , chn);\n " ,
394
394
if truthy { "" } else { "!" } ,
@@ -439,7 +439,7 @@ fn merge_ranges(ranges: &mut Vec<Range<u32>>) {
439
439
let mut last_end = None ;
440
440
for range in ranges {
441
441
if let Some ( last) = last_end {
442
- assert ! ( range. start > last, "{:?}" , range ) ;
442
+ assert ! ( range. start > last, "{range :?}" ) ;
443
443
}
444
444
last_end = Some ( range. end ) ;
445
445
}
0 commit comments