Add run-rustfix for outer_expn_data

This commit is contained in:
Philipp Hansch 2019-08-18 09:32:38 +02:00
parent a3418933c6
commit dea92fada5
No known key found for this signature in database
GPG key ID: 82AA61CAA11397E6
3 changed files with 29 additions and 2 deletions

View file

@ -0,0 +1,25 @@
// run-rustfix
#![deny(clippy::internal)]
#![feature(rustc_private)]
#[macro_use]
extern crate rustc;
use rustc::hir::Expr;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
declare_lint! {
pub TEST_LINT,
Warn,
""
}
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_data();
}
}
fn main() {}

View file

@ -1,3 +1,5 @@
// run-rustfix
#![deny(clippy::internal)]
#![feature(rustc_private)]

View file

@ -1,11 +1,11 @@
error: usage of `outer_expn().expn_data()`
--> $DIR/outer_expn_data.rs:19:33
--> $DIR/outer_expn_data.rs:21:33
|
LL | let _ = expr.span.ctxt().outer_expn().expn_data();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.outer_expn_data()`
|
note: lint level defined here
--> $DIR/outer_expn_data.rs:1:9
--> $DIR/outer_expn_data.rs:3:9
|
LL | #![deny(clippy::internal)]
| ^^^^^^^^^^^^^^^^