random::<Improve<Mutability>>()
This commit is contained in:
parent
4439f1f6a6
commit
6486ba94a3
@ -130,10 +130,7 @@ pub fn necessary_variants(&self) -> Vec<DefId> {
|
||||
pub fn contains_explicit_ref_binding(&self) -> Option<hir::Mutability> {
|
||||
let mut result = None;
|
||||
self.each_binding(|annotation, _, _, _| match annotation {
|
||||
hir::BindingAnnotation::REF => match result {
|
||||
None | Some(hir::Mutability::Not) => result = Some(hir::Mutability::Not),
|
||||
_ => {}
|
||||
},
|
||||
hir::BindingAnnotation::REF if result.is_none() => result = Some(hir::Mutability::Not),
|
||||
hir::BindingAnnotation::REF_MUT => result = Some(hir::Mutability::Mut),
|
||||
_ => {}
|
||||
});
|
||||
|
@ -749,7 +749,7 @@ fn borrow_pat_suggestion(&self, err: &mut Diagnostic, pat: &Pat<'_>) {
|
||||
format!("to take parameter `{binding}` by reference, move `&{mutability}` to the type"),
|
||||
vec![
|
||||
(pat.span.until(inner.span), "".to_owned()),
|
||||
(ty_span.shrink_to_lo(), format!("&{}", mutbl.prefix_str())),
|
||||
(ty_span.shrink_to_lo(), mutbl.ref_prefix_str().to_owned()),
|
||||
],
|
||||
Applicability::MachineApplicable
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user