@@ -184,7 +184,7 @@ pub trait InferCtxtExt<'tcx> {
184
184
trait_pred: ty::PolyTraitPredicate<'tcx>,
185
185
) -> bool;
186
186
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 >;
188
188
189
189
fn suggest_fn_call(
190
190
&self,
@@ -737,13 +737,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
737
737
/// Given a closure's `DefId`, return the given name of the closure.
738
738
///
739
739
/// 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 > {
742
742
// Get the local name of this closure. This can be inaccurate because
743
743
// of the possibility of reassignment, but this should be good enough.
744
744
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)
747
747
}
748
748
_ => {
749
749
err.note(msg);
0 commit comments