summaryrefslogtreecommitdiffstats
path: root/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui-fulldeps/auxiliary/lint-for-crate.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
index 073da688c..6304c07d2 100644
--- a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
+++ b/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
@@ -4,13 +4,13 @@
extern crate rustc_driver;
extern crate rustc_hir;
-#[macro_use]
extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;
extern crate rustc_ast;
extern crate rustc_span;
+use rustc_ast::attr;
use rustc_driver::plugin::Registry;
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_span::def_id::CRATE_DEF_ID;
@@ -28,12 +28,10 @@ impl<'tcx> LateLintPass<'tcx> for Pass {
fn check_crate(&mut self, cx: &LateContext) {
let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
let span = cx.tcx.def_span(CRATE_DEF_ID);
- if !cx.sess().contains_name(attrs, Symbol::intern("crate_okay")) {
- cx.lint(
- CRATE_NOT_OKAY,
- "crate is not marked with #![crate_okay]",
- |lint| lint.set_span(span)
- );
+ if !attr::contains_name(attrs, Symbol::intern("crate_okay")) {
+ cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| {
+ lint.set_span(span)
+ });
}
}
}