@@ -256,23 +256,14 @@ pub fn try_normalize_use_tree(
256
256
Some ( use_tree)
257
257
}
258
258
259
- macro_rules! call_and_track_result {
260
- ( $call: expr, $tracker: ident) => {
261
- let result = $call;
262
- if !$tracker && result. is_some( ) {
263
- $tracker = true ;
264
- }
265
- } ;
266
- }
267
-
268
259
pub fn try_normalize_use_tree_mut (
269
260
use_tree : & ast:: UseTree ,
270
261
style : NormalizationStyle ,
271
262
) -> Option < ( ) > {
272
263
if style == NormalizationStyle :: One {
273
264
let mut modified = false ;
274
- call_and_track_result ! ( use_tree. wrap_in_tree_list( ) , modified ) ;
275
- call_and_track_result ! ( recursive_normalize( use_tree, style) , modified ) ;
265
+ modified |= use_tree. wrap_in_tree_list ( ) . is_some ( ) ;
266
+ modified |= recursive_normalize ( use_tree, style) . is_some ( ) ;
276
267
if !modified {
277
268
// Either the use tree was already normalized or its semantically empty.
278
269
return None ;
@@ -374,10 +365,9 @@ fn recursive_normalize(use_tree: &ast::UseTree, style: NormalizationStyle) -> Op
374
365
if let Some ( sub_one_tree_list) = one_style_tree_list ( & sub_sub_tree) {
375
366
curr_skipped. extend ( sub_one_tree_list. use_trees ( ) ) ;
376
367
} else {
377
- call_and_track_result ! (
378
- recursive_normalize( & sub_sub_tree, NormalizationStyle :: Default ) ,
379
- modified
380
- ) ;
368
+ modified |=
369
+ recursive_normalize ( & sub_sub_tree, NormalizationStyle :: Default )
370
+ . is_some ( ) ;
381
371
add_element_to_list (
382
372
sub_sub_tree. syntax ( ) . clone ( ) . into ( ) ,
383
373
& mut elements,
@@ -401,10 +391,7 @@ fn recursive_normalize(use_tree: &ast::UseTree, style: NormalizationStyle) -> Op
401
391
}
402
392
modified = true ;
403
393
} else {
404
- call_and_track_result ! (
405
- recursive_normalize( & subtree, NormalizationStyle :: Default ) ,
406
- modified
407
- ) ;
394
+ modified |= recursive_normalize ( & subtree, NormalizationStyle :: Default ) . is_some ( ) ;
408
395
}
409
396
}
410
397
@@ -451,7 +438,7 @@ fn recursive_normalize(use_tree: &ast::UseTree, style: NormalizationStyle) -> Op
451
438
// Merge the remaining subtree into its parent, if its only one and
452
439
// the normalization style is not "one".
453
440
if subtrees. len ( ) == 1 && style != NormalizationStyle :: One {
454
- call_and_track_result ! ( merge_subtree_into_parent_tree( & subtrees[ 0 ] ) , modified ) ;
441
+ modified |= merge_subtree_into_parent_tree ( & subtrees[ 0 ] ) . is_some ( ) ;
455
442
}
456
443
// Order the remaining subtrees (if necessary).
457
444
if subtrees. len ( ) > 1 {
0 commit comments