From 67db88f6450401b3333e9d92a06420a8504a847d Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Sun, 21 Jul 2019 09:36:31 +0200 Subject: [PATCH] Fix breakage due to rust-lang/rust#62705 Also rename `OUTER_EXPN_INFO` to `OUTER_EXPN_EXPN_INFO` to match new function names. --- clippy_lints/src/lib.rs | 2 +- clippy_lints/src/utils/internal_lints.rs | 12 ++++++------ tests/ui/outer_expn_info.rs | 2 +- tests/ui/outer_expn_info.stderr | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index de7a213d7a4..9009207bb0e 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -668,7 +668,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { utils::internal_lints::CLIPPY_LINTS_INTERNAL, utils::internal_lints::COMPILER_LINT_FUNCTIONS, utils::internal_lints::LINT_WITHOUT_LINT_PASS, - utils::internal_lints::OUTER_EXPN_INFO, + utils::internal_lints::OUTER_EXPN_EXPN_INFO, ]); reg.register_lint_group("clippy::all", Some("clippy"), vec![ diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index aba2543b13c..6393bf2add4 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -93,9 +93,9 @@ declare_clippy_lint! { /// ```rust /// expr.span.ctxt().outer_expn_info() /// ``` - pub OUTER_EXPN_INFO, + pub OUTER_EXPN_EXPN_INFO, internal, - "using `cx.outer().expn_info()` instead of `cx.outer_expn_info()`" + "using `cx.outer_expn().expn_info()` instead of `cx.outer_expn_info()`" } declare_lint_pass!(ClippyLintsInternal => [CLIPPY_LINTS_INTERNAL]); @@ -280,7 +280,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CompilerLintFunctions { pub struct OuterExpnInfoPass; -impl_lint_pass!(OuterExpnInfoPass => [OUTER_EXPN_INFO]); +impl_lint_pass!(OuterExpnInfoPass => [OUTER_EXPN_EXPN_INFO]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnInfoPass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { @@ -288,7 +288,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnInfoPass { let method_names: Vec = method_names.iter().map(|s| s.as_str()).collect(); let method_names: Vec<&str> = method_names.iter().map(std::convert::AsRef::as_ref).collect(); if_chain! { - if let ["expn_info", "outer"] = method_names.as_slice(); + if let ["expn_info", "outer_expn"] = method_names.as_slice(); let args = arg_lists[1]; if args.len() == 1; let self_arg = &args[0]; @@ -297,9 +297,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnInfoPass { then { span_lint_and_sugg( cx, - OUTER_EXPN_INFO, + OUTER_EXPN_EXPN_INFO, expr.span.trim_start(self_arg.span).unwrap_or(expr.span), - "usage of `outer().expn_info()`", + "usage of `outer_expn().expn_info()`", "try", ".outer_expn_info()".to_string(), Applicability::MachineApplicable, diff --git a/tests/ui/outer_expn_info.rs b/tests/ui/outer_expn_info.rs index 1bc6f688805..ed0542c9298 100644 --- a/tests/ui/outer_expn_info.rs +++ b/tests/ui/outer_expn_info.rs @@ -16,7 +16,7 @@ declare_lint_pass!(Pass => [TEST_LINT]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_expr(&mut self, _cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { - let _ = expr.span.ctxt().outer().expn_info(); + let _ = expr.span.ctxt().outer_expn().expn_info(); } } diff --git a/tests/ui/outer_expn_info.stderr b/tests/ui/outer_expn_info.stderr index d9efc91da8e..4bbd1493dc4 100644 --- a/tests/ui/outer_expn_info.stderr +++ b/tests/ui/outer_expn_info.stderr @@ -1,15 +1,15 @@ -error: usage of `outer().expn_info()` +error: usage of `outer_expn().expn_info()` --> $DIR/outer_expn_info.rs:19:33 | -LL | let _ = expr.span.ctxt().outer().expn_info(); - | ^^^^^^^^^^^^^^^^^^^^ help: try: `.outer_expn_info()` +LL | let _ = expr.span.ctxt().outer_expn().expn_info(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.outer_expn_info()` | note: lint level defined here --> $DIR/outer_expn_info.rs:1:9 | LL | #![deny(clippy::internal)] | ^^^^^^^^^^^^^^^^ - = note: `#[deny(clippy::outer_expn_info)]` implied by `#[deny(clippy::internal)]` + = note: `#[deny(clippy::outer_expn_expn_info)]` implied by `#[deny(clippy::internal)]` error: aborting due to previous error