Commit 2db699b
committed
hir-ty: simplify unused_must_use container walk per review
Address ChayimFriedman2 review feedback on #22405:
* Push directly to self.diagnostics rather than threading a
&mut Vec parameter through the recursion. Drops the
check_unused_must_use / collect_unused_must_use split and the
allocation in the thin wrapper.
* Replace the recursive single-tail-chain walk (Block/Unsafe/Const)
with a loop that reassigns expr until reaching a non-chain leaf.
Branching containers (If/Match) still recurse since they have
multiple arms.
The borrow checker required hoisting the Statement::Expr pass
out of the main loop in validate_block, since MatchCheckCtx
holds &self.infcx and the must_use pass now needs &mut self.
The two passes are independent (must_use on expression
statements, non_exhaustive_let on let statements) so order is
free.
19 unused_must_use tests + 981 hir-ty tests + 693
ide-diagnostics tests pass.
Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>1 parent 68efe3e commit 2db699b
1 file changed
Lines changed: 33 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
| 419 | + | |
430 | 420 | | |
431 | 421 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
442 | 435 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
448 | 441 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
| 442 | + | |
454 | 443 | | |
455 | | - | |
456 | 444 | | |
457 | 445 | | |
458 | 446 | | |
| |||
480 | 468 | | |
481 | 469 | | |
482 | 470 | | |
483 | | - | |
| 471 | + | |
484 | 472 | | |
485 | 473 | | |
486 | 474 | | |
| |||
0 commit comments