trait_pred: ty::PolyTraitPredicate<'tcx>,
) -> bool;
- fn get_closure_name(&self, def_id: DefId, err: &mut Diagnostic, msg: &str) -> Option<String>;
+ fn get_closure_name(&self, def_id: DefId, err: &mut Diagnostic, msg: &str) -> Option<Symbol>;
fn suggest_fn_call(
&self,
/// Given a closure's `DefId`, return the given name of the closure.
///
/// This doesn't account for reassignments, but it's only used for suggestions.
- fn get_closure_name(&self, def_id: DefId, err: &mut Diagnostic, msg: &str) -> Option<String> {
- let get_name = |err: &mut Diagnostic, kind: &hir::PatKind<'_>| -> Option<String> {
+ fn get_closure_name(&self, def_id: DefId, err: &mut Diagnostic, msg: &str) -> Option<Symbol> {
+ let get_name = |err: &mut Diagnostic, kind: &hir::PatKind<'_>| -> Option<Symbol> {
// Get the local name of this closure. This can be inaccurate because
// of the possibility of reassignment, but this should be good enough.
match &kind {
- hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, name, None) => {
- Some(format!("{}", name))
+ hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, None) => {
+ Some(ident.name)
}
_ => {
err.note(msg);