Skip to content

Commit f87fe48

Browse files
refactor: update ast::Mutabiltiy variants
`Mutability` variants were renamed to `Not` and `Mut` rust-lang/rust#67355
1 parent 4a71b53 commit f87fe48

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

rustfmt-core/rustfmt-lib/src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2040,8 +2040,8 @@ fn rewrite_expr_addrof(
20402040
shape: Shape,
20412041
) -> Option<String> {
20422042
let operator_str = match mutability {
2043-
ast::Mutability::Immutable => "&",
2044-
ast::Mutability::Mutable => "&mut ",
2043+
ast::Mutability::Not => "&",
2044+
ast::Mutability::Mut => "&mut ",
20452045
};
20462046
rewrite_unary_prefix(context, operator_str, expr, shape)
20472047
}

rustfmt-core/rustfmt-lib/src/items.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ impl<'a> StaticParts<'a> {
17091709
let (prefix, ty, mutability, expr) = match item.kind {
17101710
ast::ItemKind::Static(ref ty, mutability, ref expr) => ("static", ty, mutability, expr),
17111711
ast::ItemKind::Const(ref ty, ref expr) => {
1712-
("const", ty, ast::Mutability::Immutable, expr)
1712+
("const", ty, ast::Mutability::Not, expr)
17131713
}
17141714
_ => unreachable!(),
17151715
};
@@ -1735,7 +1735,7 @@ impl<'a> StaticParts<'a> {
17351735
vis: &DEFAULT_VISIBILITY,
17361736
ident: ti.ident,
17371737
ty,
1738-
mutability: ast::Mutability::Immutable,
1738+
mutability: ast::Mutability::Not,
17391739
expr_opt: expr_opt.as_ref(),
17401740
defaultness: None,
17411741
span: ti.span,
@@ -1752,7 +1752,7 @@ impl<'a> StaticParts<'a> {
17521752
vis: &ii.vis,
17531753
ident: ii.ident,
17541754
ty,
1755-
mutability: ast::Mutability::Immutable,
1755+
mutability: ast::Mutability::Not,
17561756
expr_opt: Some(expr),
17571757
defaultness: Some(ii.defaultness),
17581758
span: ii.span,

rustfmt-core/rustfmt-lib/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ impl Rewrite for ast::Ty {
633633
}
634634
ast::TyKind::Ptr(ref mt) => {
635635
let prefix = match mt.mutbl {
636-
Mutability::Mutable => "*mut ",
637-
Mutability::Immutable => "*const ",
636+
Mutability::Mut => "*mut ",
637+
Mutability::Not => "*const ",
638638
};
639639

640640
rewrite_unary_prefix(context, prefix, &*mt.ty, shape)

rustfmt-core/rustfmt-lib/src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ pub(crate) fn format_auto(is_auto: ast::IsAuto) -> &'static str {
127127
#[inline]
128128
pub(crate) fn format_mutability(mutability: ast::Mutability) -> &'static str {
129129
match mutability {
130-
ast::Mutability::Mutable => "mut ",
131-
ast::Mutability::Immutable => "",
130+
ast::Mutability::Mut => "mut ",
131+
ast::Mutability::Not => "",
132132
}
133133
}
134134

0 commit comments

Comments
 (0)