Skip to content

Commit 6486ba9

Browse files
committed
random::<Improve<Mutability>>()
1 parent 4439f1f commit 6486ba9

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

compiler/rustc_hir/src/pat_util.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ impl hir::Pat<'_> {
130130
pub fn contains_explicit_ref_binding(&self) -> Option<hir::Mutability> {
131131
let mut result = None;
132132
self.each_binding(|annotation, _, _, _| match annotation {
133-
hir::BindingAnnotation::REF => match result {
134-
None | Some(hir::Mutability::Not) => result = Some(hir::Mutability::Not),
135-
_ => {}
136-
},
133+
hir::BindingAnnotation::REF if result.is_none() => result = Some(hir::Mutability::Not),
137134
hir::BindingAnnotation::REF_MUT => result = Some(hir::Mutability::Mut),
138135
_ => {}
139136
});

compiler/rustc_hir_typeck/src/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
749749
format!("to take parameter `{binding}` by reference, move `&{mutability}` to the type"),
750750
vec![
751751
(pat.span.until(inner.span), "".to_owned()),
752-
(ty_span.shrink_to_lo(), format!("&{}", mutbl.prefix_str())),
752+
(ty_span.shrink_to_lo(), mutbl.ref_prefix_str().to_owned()),
753753
],
754754
Applicability::MachineApplicable
755755
);

0 commit comments

Comments
 (0)