Skip to content
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 missing_panics_doc not detecting assert_eq! and assert_ne! #7029

Merged
merged 3 commits into from
Apr 5, 2021

Conversation

ABouttefeux
Copy link
Contributor

@ABouttefeux ABouttefeux commented Apr 4, 2021

fixes #6997
changelog: missing_panics_doc detects assert_eq! and assert_ne!


searching for assert_eq! and assert_ne! in FindPanicUnwrap

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 4, 2021
@ABouttefeux
Copy link
Contributor Author

ABouttefeux commented Apr 4, 2021

(Outdated)

I am not sure this the way to correct it. But is seems that even if core::panicking::assert_failed_inner use panic! it is not detected. I am not sure why.

I was also thinking to add

if is_expn_of(expr.span, "assert_eq").is_some() || is_expn_of(expr.span, "assert_ne").is_some() {
    self.panic_span = Some(expr.span);
}

in clippy_lints\src\doc.rs, FindPanicUnwrap::visit_expr instead.

@Manishearth
Copy link
Member

Can you add a test for this?

@ABouttefeux
Copy link
Contributor Author

sure :)

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 5, 2021

📌 Commit 8e5dd4b has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Apr 5, 2021

⌛ Testing commit 8e5dd4b with merge 25c1ed3...

@bors
Copy link
Collaborator

bors commented Apr 5, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 25c1ed3 to master...

@bors bors merged commit 25c1ed3 into rust-lang:master Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FN: missing_panics_doc doesn't check assert_eq!/assert_ne!
4 participants