@@ -237,7 +237,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
237
237
err. span_suggestion_verbose (
238
238
span,
239
239
"consider changing this to be mutable" ,
240
- "mut " . into ( ) ,
240
+ " mut " . into ( ) ,
241
241
Applicability :: MaybeIncorrect ,
242
242
) ;
243
243
}
@@ -1059,12 +1059,12 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool {
1059
1059
ty. is_closure ( ) || ty. is_generator ( )
1060
1060
}
1061
1061
1062
- /// Given a field that needs to be mutuable , returns a span where the mut could go.
1062
+ /// Given a field that needs to be mutable , returns a span where the " mut " could go.
1063
1063
/// This function expects the local to be a reference to a struct in order to produce a span.
1064
1064
///
1065
1065
/// ```text
1066
- /// LL | s: &'a String
1067
- /// | ^ returns a span pointing here
1066
+ /// LL | s: &'a String
1067
+ /// | ^^^ returns a span taking up the space here
1068
1068
/// ```
1069
1069
fn get_mut_span_in_struct_field < ' tcx > (
1070
1070
tcx : TyCtxt < ' tcx > ,
@@ -1081,12 +1081,10 @@ fn get_mut_span_in_struct_field<'tcx>(
1081
1081
// Now we're dealing with the actual struct that we're going to suggest a change to,
1082
1082
// we can expect a field that is an immutable reference to a type.
1083
1083
if let hir:: Node :: Field ( field) = node {
1084
- if let hir:: TyKind :: Rptr ( lifetime, hir:: MutTy { mutbl : hir:: Mutability :: Not , .. } ) =
1084
+ if let hir:: TyKind :: Rptr ( lifetime, hir:: MutTy { mutbl : hir:: Mutability :: Not , ty } ) =
1085
1085
field. ty . kind
1086
1086
{
1087
- return Some (
1088
- lifetime. span . with_hi ( lifetime. span . hi ( ) + BytePos ( 1 ) ) . shrink_to_hi ( ) ,
1089
- ) ;
1087
+ return Some ( lifetime. span . between ( ty. span ) ) ;
1090
1088
}
1091
1089
}
1092
1090
}
0 commit comments