Skip to content

Omit lenses for not runnable doctests - #5845

Merged
bors[bot] merged 1 commit into
rust-lang:masterfrom
SomeoneToIgnore:less-doctest-runnables
Aug 24, 2020
Merged

bors[bot] merged 1 commit into
rust-lang:masterfrom
SomeoneToIgnore:less-doctest-runnables

Conversation

@SomeoneToIgnore

Copy link
Copy Markdown
Contributor

Ideally, we should properly parse the doctest attributes before, but since I need it for the code lens only, this way should suffice for now

fn has_runnable_doc_test(fn_def: &ast::Fn) -> bool {
fn_def.doc_comment_text().map_or(false, |comments_text| {
comments_text.contains("```")
&& !comments_text.contains("```ignore")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If ```ignore is equivalent to#[ignore]` you can still explicitly run them, or run them by saying that even ignored tests should run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I run it explicitly, it does not run it anyway, so I guess I have to use that option somehow:

image

So it looks like it makes not much sense to keep the lens for it, even there's a way to configure this option somehow globally so it propagates to the lens runners also.

@matklad

matklad commented Aug 24, 2020

Copy link
Copy Markdown
Contributor

bors r+

cc #4873, which adds markdown parser

@bors

bors Bot commented Aug 24, 2020

Copy link
Copy Markdown
Contributor

@bors
bors Bot merged commit 150e384 into rust-lang:master Aug 24, 2020
@SomeoneToIgnore
SomeoneToIgnore deleted the less-doctest-runnables branch August 24, 2020 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants