Rollup merge of #116625 - nnethercote:rustc_hir_pretty, r=fee1-dead

`rustc_hir_pretty` cleanups

Just some improvements I found while looking through this code.

r? ``@fee1-dead``
This commit is contained in:
Matthias Krüger 2023-10-12 18:36:43 +02:00 committed by GitHub
commit 0b8495b6ac
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ pub(crate) fn check<'tcx>(cx: &LateContext<'tcx>, ex: &Expr<'tcx>, arms: &[Arm<'
if is_type_diagnostic_item(cx, ex_ty, sym::Result) { if is_type_diagnostic_item(cx, ex_ty, sym::Result) {
for arm in arms { for arm in arms {
if let PatKind::TupleStruct(ref path, inner, _) = arm.pat.kind { if let PatKind::TupleStruct(ref path, inner, _) = arm.pat.kind {
let path_str = rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_qpath(path, false)); let path_str = rustc_hir_pretty::qpath_to_string(path);
if path_str == "Err" { if path_str == "Err" {
let mut matching_wild = inner.iter().any(is_wild); let mut matching_wild = inner.iter().any(is_wild);
let mut ident_bind_name = kw::Underscore; let mut ident_bind_name = kw::Underscore;

View File

@ -49,7 +49,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
cx, cx,
arguments.iter().collect(), arguments.iter().collect(),
cx.typeck_results().expr_ty(fn_expr), cx.typeck_results().expr_ty(fn_expr),
&rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_qpath(path, false)), &rustc_hir_pretty::qpath_to_string(path),
"function", "function",
); );
} }