Also rename `OUTER_EXPN_INFO` to `OUTER_EXPN_EXPN_INFO` to match new
function names.
This commit is contained in:
Michael Wright 2019-07-21 09:36:31 +02:00
parent bd4c4e7e73
commit 67db88f645
4 changed files with 12 additions and 12 deletions

View File

@ -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![

View File

@ -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<LocalInternedString> = 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,

View File

@ -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();
}
}

View File

@ -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