1
Fork 0

Update tests

This commit is contained in:
John Kåre Alsaker 2020-02-13 11:17:49 +01:00
parent 7118f71ea1
commit 8b8041efc0
2 changed files with 4 additions and 4 deletions

View file

@ -29,10 +29,10 @@ macro_rules! fake_lint_pass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct {
fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) {
$(
if !attr::contains_name(&krate.attrs, $attr) {
if !attr::contains_name(&krate.item.attrs, $attr) {
cx.lint(CRATE_NOT_OKAY, |lint| {
let msg = format!("crate is not marked with #![{}]", $attr);
lint.build(&msg).set_span(krate.span).emit()
lint.build(&msg).set_span(krate.item.span).emit()
});
}
)*

View file

@ -27,10 +27,10 @@ declare_lint_pass!(Pass => [CRATE_NOT_OKAY]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) {
if !attr::contains_name(&krate.attrs, Symbol::intern("crate_okay")) {
if !attr::contains_name(&krate.item.attrs, Symbol::intern("crate_okay")) {
cx.lint(CRATE_NOT_OKAY, |lint| {
lint.build("crate is not marked with #![crate_okay]")
.set_span(krate.span)
.set_span(krate.item.span)
.emit()
});
}