Skip to content

Commit 4d0d6f5

Browse files
committed
Cleanup: use Mutability::ptr_str() method
1 parent f85331f commit 4d0d6f5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clippy_lints/src/casts/borrow_as_ptr.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ pub(super) fn check<'tcx>(
2929
}
3030

3131
let (suggestion, span) = if msrv.meets(cx, msrvs::RAW_REF_OP) {
32-
let operator_kind = match mutability {
33-
Mutability::Not => "const",
34-
Mutability::Mut => "mut",
35-
};
3632
// Make sure that the span to be replaced doesn't include parentheses, that could break the
3733
// suggestion.
3834
let span = if has_enclosing_paren(snippet_with_applicability(cx, expr.span, "", &mut app)) {
@@ -42,7 +38,7 @@ pub(super) fn check<'tcx>(
4238
} else {
4339
expr.span
4440
};
45-
(format!("&raw {operator_kind} {snip}"), span)
41+
(format!("&raw {} {snip}", mutability.ptr_str()), span)
4642
} else {
4743
let Some(std_or_core) = std_or_core(cx) else {
4844
return false;

0 commit comments

Comments
 (0)