Skip to content

Commit ac4bb00

Browse files
committed
rustfmt: BindingAnnotation change
1 parent 02ba216 commit ac4bb00

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tools/rustfmt/src/patterns.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use rustc_ast::ast::{self, BindingMode, Pat, PatField, PatKind, RangeEnd, RangeSyntax};
1+
use rustc_ast::ast::{
2+
self, BindingAnnotation, ByRef, Pat, PatField, PatKind, RangeEnd, RangeSyntax,
3+
};
24
use rustc_ast::ptr;
35
use rustc_span::{BytePos, Span};
46

@@ -99,10 +101,10 @@ impl Rewrite for Pat {
99101
write_list(&items, &fmt)
100102
}
101103
PatKind::Box(ref pat) => rewrite_unary_prefix(context, "box ", &**pat, shape),
102-
PatKind::Ident(binding_mode, ident, ref sub_pat) => {
103-
let (prefix, mutability) = match binding_mode {
104-
BindingMode::ByRef(mutability) => ("ref", mutability),
105-
BindingMode::ByValue(mutability) => ("", mutability),
104+
PatKind::Ident(BindingAnnotation(by_ref, mutability), ident, ref sub_pat) => {
105+
let prefix = match by_ref {
106+
ByRef::Yes => "ref",
107+
ByRef::No => "",
106108
};
107109
let mut_infix = format_mutability(mutability).trim();
108110
let id_str = rewrite_ident(context, ident);

0 commit comments

Comments
 (0)