Skip to content

Commit

Permalink
Fix fulldeps tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jun 23, 2020
1 parent 0f31095 commit 312c2fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass {
_: intravisit::FnKind<'tcx>,
_: &'tcx hir::FnDecl,
_: &'tcx hir::Body,
span: source_map::Span,
id: hir::HirId,
) {
let item = match cx.tcx.hir().get(id) {
Expand All @@ -51,6 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass {
let whitelisted = |attr| pprust::attribute_to_string(attr).contains("whitelisted_attr");
if !item.attrs.iter().any(whitelisted) {
cx.lint(MISSING_WHITELISTED_ATTR, |lint| {
let span = cx.tcx.hir().span(id);
lint.build("Missing 'whitelisted_attr' attribute").set_span(span).emit()
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ macro_rules! fake_lint_pass {
$(
if !attr::contains_name(&krate.item.attrs, $attr) {
cx.lint(CRATE_NOT_OKAY, |lint| {
let span = cx.tcx.hir().span(rustc_hir::CRATE_HIR_ID);
let msg = format!("crate is not marked with #![{}]", $attr);
lint.build(&msg).set_span(krate.item.span).emit()
lint.build(&msg).set_span(span).emit()
});
}
)*
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui-fulldeps/auxiliary/lint-for-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) {
if !attr::contains_name(&krate.item.attrs, Symbol::intern("crate_okay")) {
cx.lint(CRATE_NOT_OKAY, |lint| {
let span = cx.tcx.hir().span(rustc_hir::CRATE_HIR_ID);
lint.build("crate is not marked with #![crate_okay]")
.set_span(krate.item.span)
.set_span(span)
.emit()
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]);

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) {
let it_span = cx.tcx.hir().span(it.hir_id);
match &*it.ident.as_str() {
"lintme" => cx.lint(TEST_LINT, |lint| {
lint.build("item is named 'lintme'").set_span(it.span).emit()
lint.build("item is named 'lintme'").set_span(it_span).emit()
}),
"pleaselintme" => cx.lint(PLEASE_LINT, |lint| {
lint.build("item is named 'pleaselintme'").set_span(it.span).emit()
lint.build("item is named 'pleaselintme'").set_span(it_span).emit()
}),
_ => {}
}
Expand Down

0 comments on commit 312c2fb

Please sign in to comment.