Commit 99317ef
committed
Auto merge of rust-lang#146121 - Muscraft:filter-suggestion-parts, r=petrochenkov
fix: Filter suggestion parts that match existing code
While testing my changes to make `rustc` use `annotate-snippets`, I encountered a new `clippy` test failure stemming from [two](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R275-R278) [suggestion](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R289-R292) output changes in rust-lang#145273. The new output in these two cases feels like a regression as it is not as clear as the old output, and adds unnecessary information.
Before rust-lang#145273 (`Diff` style)

After rust-lang#145273 ("multi-line" style)

The reason for the change was that a new suggestion part (which matches existing code) was added on a different line than the existing parts, causing the suggestion style to change from `Diff` to "multi-line". Since this new part matches existing code, no code changes show up in the output for it, but it still makes the suggestion style "multi-line" when it doesn't need to be.
To get the old output back, I made it so that suggestion parts that perfectly match existing code get filtered out.
try-job: aarch64-appleFile tree
4 files changed
+21
-24
lines changed- compiler/rustc_errors/src
- src/tools/clippy/tests/ui
4 files changed
+21
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | 948 | | |
954 | 949 | | |
955 | 950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2354 | 2354 | | |
2355 | 2355 | | |
2356 | 2356 | | |
2357 | | - | |
2358 | 2357 | | |
2359 | 2358 | | |
2360 | 2359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
384 | 395 | | |
385 | 396 | | |
386 | 397 | | |
| |||
470 | 481 | | |
471 | 482 | | |
472 | 483 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
483 | 490 | | |
484 | 491 | | |
485 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 275 | + | |
| 276 | + | |
279 | 277 | | |
280 | 278 | | |
281 | 279 | | |
| |||
286 | 284 | | |
287 | 285 | | |
288 | 286 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
| 287 | + | |
| 288 | + | |
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
| |||
0 commit comments