@@ -237,7 +237,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
237237 err. span_suggestion_verbose (
238238 span,
239239 "consider changing this to be mutable" ,
240- "mut " . into ( ) ,
240+ " mut " . into ( ) ,
241241 Applicability :: MaybeIncorrect ,
242242 ) ;
243243 }
@@ -1059,12 +1059,12 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool {
10591059 ty. is_closure ( ) || ty. is_generator ( )
10601060}
10611061
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.
10631063/// This function expects the local to be a reference to a struct in order to produce a span.
10641064///
10651065/// ```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
10681068/// ```
10691069fn get_mut_span_in_struct_field < ' tcx > (
10701070 tcx : TyCtxt < ' tcx > ,
@@ -1081,12 +1081,10 @@ fn get_mut_span_in_struct_field<'tcx>(
10811081 // Now we're dealing with the actual struct that we're going to suggest a change to,
10821082 // we can expect a field that is an immutable reference to a type.
10831083 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 } ) =
10851085 field. ty . kind
10861086 {
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 ) ) ;
10901088 }
10911089 }
10921090 }
0 commit comments