Skip to content

Commit

Permalink
rustfmt: BindingAnnotation change
Browse files Browse the repository at this point in the history
  • Loading branch information
camsteffen committed Sep 2, 2022
1 parent ddda7bb commit e40972e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/patterns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use rustc_ast::ast::{self, BindingMode, Pat, PatField, PatKind, RangeEnd, RangeSyntax};
use rustc_ast::ast::{
self, BindingAnnotation, ByRef, Pat, PatField, PatKind, RangeEnd, RangeSyntax,
};
use rustc_ast::ptr;
use rustc_span::{BytePos, Span};

Expand Down Expand Up @@ -99,10 +101,10 @@ impl Rewrite for Pat {
write_list(&items, &fmt)
}
PatKind::Box(ref pat) => rewrite_unary_prefix(context, "box ", &**pat, shape),
PatKind::Ident(binding_mode, ident, ref sub_pat) => {
let (prefix, mutability) = match binding_mode {
BindingMode::ByRef(mutability) => ("ref", mutability),
BindingMode::ByValue(mutability) => ("", mutability),
PatKind::Ident(BindingAnnotation(by_ref, mutability), ident, ref sub_pat) => {
let prefix = match by_ref {
ByRef::Yes => "ref",
ByRef::No => "",
};
let mut_infix = format_mutability(mutability).trim();
let id_str = rewrite_ident(context, ident);
Expand Down

0 comments on commit e40972e

Please sign in to comment.