diff options
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/expr.rs b/src/expr.rs index 8545b0f6f29..ed10a54c2a3 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1988,14 +1988,16 @@ pub(crate) fn prefer_next_line( fn rewrite_expr_addrof( context: &RewriteContext<'_>, - _borrow_kind: ast::BorrowKind, + borrow_kind: ast::BorrowKind, mutability: ast::Mutability, expr: &ast::Expr, shape: Shape, ) -> Option<String> { - let operator_str = match mutability { - ast::Mutability::Not => "&", - ast::Mutability::Mut => "&mut ", + let operator_str = match (mutability, borrow_kind) { + (ast::Mutability::Not, ast::BorrowKind::Ref) => "&", + (ast::Mutability::Not, ast::BorrowKind::Raw) => "&raw const ", + (ast::Mutability::Mut, ast::BorrowKind::Ref) => "&mut ", + (ast::Mutability::Mut, ast::BorrowKind::Raw) => "&raw mut ", }; rewrite_unary_prefix(context, operator_str, expr, shape) } |
