-
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
Fix unwrap not to lint the #[test]ing code #5842
Conversation
tests/ui/unwrap.rs
Outdated
with_test(); | ||
with_cfg_test(); |
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 don't think you need to add these function to main.
Use https://rustc-dev-guide.rust-lang.org/tests/adding.html#revisions with compile flag for test
is better I think.
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.
Thank you for the review and suggestion. I will fix this later.
26cf568
to
48d223f
Compare
tests/ui/unwrap.rs
Outdated
// Should not get linted. | ||
#[test] | ||
fn with_test() { |
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.
This doesn't get linted, but not because the linting code prevents this. Code marked with #[test]
attributes in an UI test file will get removed, before the test is run.
48d223f
to
57b3f70
Compare
☔ The latest upstream changes (presumably #5809) made this pull request unmergeable. Please resolve the merge conflicts. |
10ea4c8
to
f750a3f
Compare
Impl looks good to me now, but tests are missing. |
e768946
to
c8ad132
Compare
c8ad132
to
2d07c6f
Compare
error: used `unwrap()` on `an Option` value | ||
--> $DIR/unwrap.rs:20:17 | ||
| | ||
LL | let _ = opt.unwrap(); | ||
| ^^^^^^^^^^^^ | ||
| | ||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message |
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.
Wait, this shouldn't get linted 🤔
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.
Yeah, I'm debugging right now but stacking
2d07c6f
to
d38fe0f
Compare
ping from triage @chansuke. It seems the bug with the test module wasn't fixed yet. Do you need help with debugging this? |
@flip1995 i need help, thanks. |
Uhm, the |
@flip1995 Sorry, I tried to fix but stuck. I would like to close my PR. |
Fixes #5805.
changelog: none