diff options
| author | Timo <30553356+y21@users.noreply.github.com> | 2025-02-07 00:45:33 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 00:45:33 +0000 |
| commit | 4a94ad6c5233ae51865a2dad0068bbfe60daed45 (patch) | |
| tree | 3440f5b464bf0c736d577d991d1d8615c0cd2d0b /tests/codegen/patchable-function-entry | |
| parent | dc330b89a8f59a3c3cd0dc7fb8c51e963b4f6250 (diff) | |
| parent | 64dec0760e652878399155e4621063ecce88b12b (diff) | |
| download | rust-4a94ad6c5233ae51865a2dad0068bbfe60daed45.tar.gz rust-4a94ad6c5233ae51865a2dad0068bbfe60daed45.zip | |
Simplify `reindent_multiline()` signature (#14101)
- `reindent_multiline()` always returns the result of
`reindent_multiline_inner()` which returns a `String`. Make
`reindent_multiline()` return a `String` as well, instead of a
systematically owned `Cow<'_, str>`.
- There is no reason for `reindent_multiline()` to force a caller to
build a `Cow<'_, str>` instead of passing a `&str` directly, especially
considering that a `String` will always be returned.
Also, both the input parameter and return value (of type `Cow<'_, str>`)
shared the same (elided) lifetime for no reason: this worked only
because the result was always the `Cow::Owned` variant which is
compatible with any lifetime.
As a consequence, the signature changes from:
```rust
fn reindent_multiline(s: Cow<'_, str>, …) -> Cow<'_, str> { … }
```
to
```rust
fn reindent_multiline(s: &str, …) -> String { … }
```
changelog: none
Diffstat (limited to 'tests/codegen/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions
