diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-10 14:02:42 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-10 14:08:12 +1100 |
| commit | 359fa9822b4130a97197df0d9cf8a642013cd9a2 (patch) | |
| tree | 1b45b2652e449bbf21d0fd928d64a31fd7ece29e | |
| parent | 56400a065083038444e876c0cea071d2e61cd00e (diff) | |
| download | rust-359fa9822b4130a97197df0d9cf8a642013cd9a2.tar.gz rust-359fa9822b4130a97197df0d9cf8a642013cd9a2.zip | |
Rejig some top-level `rustc_hir_pretty` functions.
There are several that are unused and can be removed. And there are some calls to `to_string`, which can be expressed more nicely as a `foo_to_string` call, and then `to_string` need not be `pub`. (This requires adding `pat_to_string`).
| -rw-r--r-- | clippy_lints/src/matches/match_wild_err_arm.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/mut_reference.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/matches/match_wild_err_arm.rs b/clippy_lints/src/matches/match_wild_err_arm.rs index de911f7a028..a2903e52ae0 100644 --- a/clippy_lints/src/matches/match_wild_err_arm.rs +++ b/clippy_lints/src/matches/match_wild_err_arm.rs @@ -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) { for arm in arms { 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" { let mut matching_wild = inner.iter().any(is_wild); let mut ident_bind_name = kw::Underscore; diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index e53e146ec5d..01b850cdb11 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMutPassed { cx, arguments.iter().collect(), 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", ); } |
