-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid eq_op
in test code
#7811
avoid eq_op
in test code
#7811
Conversation
r? @xFrednet (rust-highfive has picked a reviewer for you, use r? to override) |
I did |
Yeah, that's really strange. Tests work locally, so I'm not too worried. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, just a small NIT, the rest LGTM 🙃
ca5d48a
to
ebfa8a1
Compare
I now have extended our compile-test harness to compile tests in |
The dev guide has something to say about how tests are compiled. So basically all we get is a |
Zulip user DevinR528 found a solution. As looking into the expansion data doesn't seem to help, I'm going to incorporate that for now. Thanks, Devin! |
ebfa8a1
to
f04bab4
Compare
The error seems unrelated but persistent even on re-running the jobs. |
f04bab4
to
c6fc665
Compare
Ah, I see! I change the compiletest parameters without cloning the Config, and as a result, everything afterwards gets compiled with Luckily that's easy to fix. |
c6fc665
to
f34abb4
Compare
Now all tests pass this should be ready for review. |
let parent_mod = tcx.parent_module(id); | ||
let mut vis = VisitConstTestStruct { names, found: false }; | ||
tcx.hir().visit_item_likes_in_module(parent_mod, &mut vis); | ||
vis.found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use tcx.item_children
instead of a visitor here. I would just check item.name
and #[rustc_test_marker]
and then you don't need to go into item.kind
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think you can't do tcx.parent_module
since you can have
fn f() {
#[test]
fn t() {} // the test marker is in a fn not a module
}
so maybe move this logic inside the parent iteration where you find ItemKind::Fn
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider nested test methods a degenerate case and if those who do this get a false positive, they likely deserve it 😜.
@camsteffen I've added the |
f34abb4
to
94d1f37
Compare
@xFrednet r? |
Jup, I'll try to review this today. The code I already saw was looking good 👍. One NIT I already found, could you document that lints using |
94d1f37
to
0d738be
Compare
@xFrednet Done! |
0d738be
to
e88c956
Compare
@xFrednet now r? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Thank you for the changes! 🙃 @bors r+ |
📌 Commit e88c956 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Add a check to
eq_op
that will avoid linting in functions annotated with#[test]
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: avoid
eq_op
in test functions