about summary refs log tree commit diff
path: root/tests/codegen/patchable-function-entry
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-01-29 17:28:03 +0100
committerSamuel Tardieu <sam@rfc1149.net>2025-02-03 23:47:08 +0100
commit64dec0760e652878399155e4621063ecce88b12b (patch)
treeceb992906ff74d2dae3d0ebf4a23fd72ffe5df3b /tests/codegen/patchable-function-entry
parentc5218d509b8bb0d925014f73b2aad89601e71871 (diff)
downloadrust-64dec0760e652878399155e4621063ecce88b12b.tar.gz
rust-64dec0760e652878399155e4621063ecce88b12b.zip
Simplify `reindent_multiline()` signature
- `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 { … }
```
Diffstat (limited to 'tests/codegen/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions