1
Fork 0

Remove redundant to_ident_string calls

This commit is contained in:
Michael Goulet 2025-01-27 01:21:40 +00:00
parent ac1c6c50f4
commit c08624d8d2
10 changed files with 14 additions and 18 deletions

View file

@ -343,5 +343,5 @@ fn path_span_without_args(path: &Path<'_>) -> Span {
/// Return a "error message-able" ident for the last segment of the `Path`
fn path_name_to_string(path: &Path<'_>) -> String {
path.segments.last().unwrap().ident.name.to_ident_string()
path.segments.last().unwrap().ident.to_string()
}

View file

@ -45,7 +45,7 @@ fn path_for_pass_by_value(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> Option<Stri
if let TyKind::Path(QPath::Resolved(_, path)) = &ty.kind {
match path.res {
Res::Def(_, def_id) if cx.tcx.has_attr(def_id, sym::rustc_pass_by_value) => {
let name = cx.tcx.item_name(def_id).to_ident_string();
let name = cx.tcx.item_ident(def_id);
let path_segment = path.segments.last().unwrap();
return Some(format!("{}{}", name, gen_args(cx, path_segment)));
}