about summary refs log tree commit diff
path: root/library/std/src/io/util.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-14 16:23:32 +0100
committerGitHub <noreply@github.com>2025-02-14 16:23:32 +0100
commit49fb61c4961bb0244abe708d24a5e206a96f5304 (patch)
tree03482cdae92844b955eb8b0b1ee2d9866129b2c7 /library/std/src/io/util.rs
parent2980f75713c9ed59dbcdd2f7a272cc13755085ce (diff)
parent6d71251cf9e40326461f90f8ff9a7024706aea87 (diff)
downloadrust-49fb61c4961bb0244abe708d24a5e206a96f5304.tar.gz
rust-49fb61c4961bb0244abe708d24a5e206a96f5304.zip
Rollup merge of #136958 - compiler-errors:additive-replacmeent, r=estebank
Fix presentation of purely "additive" replacement suggestion parts

#127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced.

Consider:

```
LL -     Self::Baz: Clone,
LL +     Self::Baz: Clone, T: std::clone::Clone
```

In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now.

Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of #127541.

---

In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means.

---

r? estebank
Diffstat (limited to 'library/std/src/io/util.rs')
0 files changed, 0 insertions, 0 deletions