@@ -184,7 +184,7 @@ pub trait InferCtxtExt<'tcx> {
184184 trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
185185 ) -> bool ;
186186
187- fn get_closure_name ( & self , def_id : DefId , err : & mut Diagnostic , msg : & str ) -> Option < String > ;
187+ fn get_closure_name ( & self , def_id : DefId , err : & mut Diagnostic , msg : & str ) -> Option < Symbol > ;
188188
189189 fn suggest_fn_call (
190190 & self ,
@@ -737,13 +737,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
737737 /// Given a closure's `DefId`, return the given name of the closure.
738738 ///
739739 /// This doesn't account for reassignments, but it's only used for suggestions.
740- fn get_closure_name ( & self , def_id : DefId , err : & mut Diagnostic , msg : & str ) -> Option < String > {
741- let get_name = |err : & mut Diagnostic , kind : & hir:: PatKind < ' _ > | -> Option < String > {
740+ fn get_closure_name ( & self , def_id : DefId , err : & mut Diagnostic , msg : & str ) -> Option < Symbol > {
741+ let get_name = |err : & mut Diagnostic , kind : & hir:: PatKind < ' _ > | -> Option < Symbol > {
742742 // Get the local name of this closure. This can be inaccurate because
743743 // of the possibility of reassignment, but this should be good enough.
744744 match & kind {
745- hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , _, name , None ) => {
746- Some ( format ! ( "{}" , name) )
745+ hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , _, ident , None ) => {
746+ Some ( ident . name )
747747 }
748748 _ => {
749749 err. note ( msg) ;
0 commit comments