@@ -902,7 +902,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
902902 hir:: ExprKind :: MethodCall ( .., args, _) => {
903903 // only the first closre parameter of the method. args[0] is MethodCall PathSegment
904904 for i in 1 ..args. len ( ) {
905- if let hir:: ExprKind :: Closure ( ..) = args[ i] . kind {
905+ if let hir:: ExprKind :: Closure ( hir:: Closure {
906+ capture_clause : hir:: CaptureBy :: Ref ,
907+ ..
908+ } ) = args[ i] . kind
909+ {
906910 closure_span = Some ( args[ i] . span . shrink_to_lo ( ) ) ;
907911 break ;
908912 }
@@ -911,7 +915,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
911915 hir:: ExprKind :: Block ( blk, _) => {
912916 if let Some ( ref expr) = blk. expr {
913917 // only when the block is a closure
914- if let hir:: ExprKind :: Closure ( ..) = expr. kind {
918+ if let hir:: ExprKind :: Closure ( hir:: Closure {
919+ capture_clause : hir:: CaptureBy :: Ref ,
920+ ..
921+ } ) = expr. kind
922+ {
915923 closure_span = Some ( expr. span . shrink_to_lo ( ) ) ;
916924 }
917925 }
@@ -921,7 +929,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
921929 if let Some ( closure_span) = closure_span {
922930 diag. span_suggestion_verbose (
923931 closure_span,
924- format ! ( "consider adding 'move' keyword before the nested closure" ) ,
932+ "consider adding 'move' keyword before the nested closure" ,
925933 "move " ,
926934 Applicability :: MaybeIncorrect ,
927935 ) ;
0 commit comments