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

Parse doctests in needless_doctest_main #5912

Merged
merged 1 commit into from
Aug 16, 2020

Conversation

ebroto
Copy link
Member

@ebroto ebroto commented Aug 15, 2020

This switches from text-based search to running the parser to avoid false positives. Inspired by how rustdoc handles this and by #4729.

cc @llogiq

changelog: Fix multiple false positives in [needless_doctest_main].

Fixes #5879
Fixes #4906
Fixes #5103
Fixes #4698

@rust-highfive
Copy link

r? @Manishearth

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 15, 2020
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine to me, is there a perf impact? cc @flip1995 to sanity check the approach here

@flip1995
Copy link
Member

Perf aspect is, that Clippy now parses items in doc code. But I don't think that this has much of an impact, since there shouldn't be that many Items. If there are no items, the loop statement will directly return. This change only executes code other than return false if it finds a function, that could be main.

-> I think perf wise, this should be fine. 👍

@flip1995
Copy link
Member

@bors r=Manishearth,flip1995

@bors
Copy link
Collaborator

bors commented Aug 16, 2020

📌 Commit 1a140dc has been approved by Manishearth,flip1995

@bors
Copy link
Collaborator

bors commented Aug 16, 2020

⌛ Testing commit 1a140dc with merge f8db258...

@bors
Copy link
Collaborator

bors commented Aug 16, 2020

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

@bors bors merged commit f8db258 into rust-lang:master Aug 16, 2020
@ebroto ebroto deleted the needless_doctest_main_improvements branch August 16, 2020 20:23
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
5 participants