diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-03-16 18:13:29 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-03-16 18:17:18 +0100 |
| commit | 4d0d6f591dc903ba151735e246005c354eb8f4ee (patch) | |
| tree | be06e8b675811162d76a9b80792033f0102064ea | |
| parent | f85331f4d1efc2878b3ad8bdf5d2ac73fbe0eb2e (diff) | |
| download | rust-4d0d6f591dc903ba151735e246005c354eb8f4ee.tar.gz rust-4d0d6f591dc903ba151735e246005c354eb8f4ee.zip | |
Cleanup: use `Mutability::ptr_str()` method
| -rw-r--r-- | clippy_lints/src/casts/borrow_as_ptr.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/clippy_lints/src/casts/borrow_as_ptr.rs b/clippy_lints/src/casts/borrow_as_ptr.rs index 64345c81a24..0c9639f3ea6 100644 --- a/clippy_lints/src/casts/borrow_as_ptr.rs +++ b/clippy_lints/src/casts/borrow_as_ptr.rs @@ -29,10 +29,6 @@ pub(super) fn check<'tcx>( } let (suggestion, span) = if msrv.meets(cx, msrvs::RAW_REF_OP) { - let operator_kind = match mutability { - Mutability::Not => "const", - Mutability::Mut => "mut", - }; // Make sure that the span to be replaced doesn't include parentheses, that could break the // suggestion. let span = if has_enclosing_paren(snippet_with_applicability(cx, expr.span, "", &mut app)) { @@ -42,7 +38,7 @@ pub(super) fn check<'tcx>( } else { expr.span }; - (format!("&raw {operator_kind} {snip}"), span) + (format!("&raw {} {snip}", mutability.ptr_str()), span) } else { let Some(std_or_core) = std_or_core(cx) else { return false; |
