about summary refs log tree commit diff
path: root/tests/codegen/patchable-function-entry
diff options
context:
space:
mode:
authorTimo <30553356+y21@users.noreply.github.com>2025-02-07 00:45:33 +0000
committerGitHub <noreply@github.com>2025-02-07 00:45:33 +0000
commit4a94ad6c5233ae51865a2dad0068bbfe60daed45 (patch)
tree3440f5b464bf0c736d577d991d1d8615c0cd2d0b /tests/codegen/patchable-function-entry
parentdc330b89a8f59a3c3cd0dc7fb8c51e963b4f6250 (diff)
parent64dec0760e652878399155e4621063ecce88b12b (diff)
downloadrust-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