rust/clippy_lints/src/matches
Samuel Tardieu 64dec0760e 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 { … }
```
2025-02-03 23:47:08 +01:00
..
collapsible_match.rs Merge commit 'ff4a26d442' into clippy-subtree-update 2024-11-28 19:38:59 +01:00
infallible_destructuring_match.rs Implement mut ref/mut ref mut 2024-03-27 09:53:23 -04:00
manual_filter.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
manual_map.rs Merge commit '7901289135' into clippy-subtree-update 2024-09-24 11:58:04 +02:00
manual_ok_err.rs New lint: manual_ok_err 2025-01-10 18:26:01 +01:00
manual_unwrap_or.rs Simplify reindent_multiline() signature 2025-02-03 23:47:08 +01:00
manual_utils.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
match_as_ref.rs new manual_option_as_slice lint 2025-01-26 21:27:44 +01:00
match_bool.rs Merge remote-tracking branch 'upstream/master' into rustup 2025-01-28 19:14:45 +01:00
match_like_matches.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
match_on_vec_items.rs Merge commit 'edb720b199' into clippyup 2023-11-16 19:13:24 +01:00
match_ref_pats.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
match_same_arms.rs Rename PatKind::Lit to Expr 2025-01-08 07:34:59 +00:00
match_single_binding.rs Rename hir::Node::Local into hir::Node::LetStmt 2024-03-22 20:48:36 +01:00
match_str_case_mismatch.rs Merge remote-tracking branch 'upstream/master' into rustup 2025-01-28 19:14:45 +01:00
match_wild_enum.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
match_wild_err_arm.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
mod.rs New lint: manual_ok_err 2025-01-10 18:26:01 +01:00
needless_match.rs Merge remote-tracking branch 'upstream/master' into rustup 2025-01-09 18:00:37 +01:00
overlapping_arms.rs Get rid of mir::Const::from_ty_const 2025-01-20 04:26:44 +00:00
redundant_guards.rs Merge commit 'ff4a26d442' into clippy-subtree-update 2024-11-28 19:38:59 +01:00
redundant_pattern_match.rs Merge commit '19e305bb57' into clippy-subtree-update 2025-01-09 18:57:00 +01:00
rest_pat_in_fully_bound_struct.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
significant_drop_in_scrutinee.rs fix: correct suggestion for significant_drop_in_scrutinee in expressions 2025-01-17 23:54:42 +05:30
single_match.rs Merge commit '19e305bb57' into clippy-subtree-update 2025-01-09 18:57:00 +01:00
try_err.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00
wild_in_or_pats.rs Apply unnecessary_semicolon to Clippy sources 2025-01-19 15:34:07 +01:00