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

Add extra indent spaces for rust-playground link #121095

Merged

Conversation

chenyukang
Copy link
Member

@chenyukang chenyukang commented Feb 14, 2024

Fixes #120998

Seems add rustfmt for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.

@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2024

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 14, 2024
@@ -725,7 +732,17 @@ pub(crate) fn make_test(
// /// ``` <- end of the inner main
line_offset += 1;

prog.extend([&main_pre, everything_else, &main_post].iter().cloned());
// add extra 4 spaces for each line to offset the code block
let content = if opts.insert_extra_ident_space {
Copy link
Member

Choose a reason for hiding this comment

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

Unless I missed something, it changes the generated test code and not just the playground URL right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I only set opts.insert_extra_ident_space to true for generating code link of Rust playground

Copy link
Member

Choose a reason for hiding this comment

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

👍

@GuillaumeGomez
Copy link
Member

Looks good to me. Can you add a test when the main function is provided in the documentation already please?

@chenyukang chenyukang force-pushed the yukang-fix-120998-rust-playground-link branch from 9f86522 to d911a07 Compare February 15, 2024 10:56
@chenyukang chenyukang force-pushed the yukang-fix-120998-rust-playground-link branch from d911a07 to bd546fb Compare February 15, 2024 10:57
@chenyukang
Copy link
Member Author

Looks good to me. Can you add a test when the main function is provided in the documentation already please?

added unit test make_test_insert_extra_space_fn_main.

@GuillaumeGomez
Copy link
Member

Thanks a lot!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 15, 2024

📌 Commit bd546fb has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 15, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 15, 2024
…playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
oli-obk added a commit to oli-obk/rust that referenced this pull request Feb 15, 2024
…playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
…llaumeGomez

Rollup of 13 pull requests

Successful merges:

 - rust-lang#118264 (Optimize `VecDeque::drain` for (half-)open ranges)
 - rust-lang#120741 (Make `io::BorrowedCursor::advance` safe)
 - rust-lang#120777 (Bump Unicode to version 15.1.0, regenerate tables)
 - rust-lang#120971 (Fix comment in core/src/str/validations.rs)
 - rust-lang#121034 (Improve wording of `static_mut_ref`)
 - rust-lang#121095 (Add extra indent spaces for rust-playground link)
 - rust-lang#121109 (Add an ErrorGuaranteed to ast::TyKind::Err (attempt 2))
 - rust-lang#121119 (Make `async Fn` trait kind errors better)
 - rust-lang#121141 (Fix closure kind docs)
 - rust-lang#121145 (Update aarch64 target feature docs to match LLVM)
 - rust-lang#121146 (Only point out non-diverging arms for match suggestions)
 - rust-lang#121147 (Avoid debug logging entire MIR body)
 - rust-lang#121155 (doc: add note about panicking examples for strict_overflow_ops)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2024
…llaumeGomez

Rollup of 10 pull requests

Successful merges:

 - rust-lang#120777 (Bump Unicode to version 15.1.0, regenerate tables)
 - rust-lang#120971 (Fix comment in core/src/str/validations.rs)
 - rust-lang#121095 (Add extra indent spaces for rust-playground link)
 - rust-lang#121109 (Add an ErrorGuaranteed to ast::TyKind::Err (attempt 2))
 - rust-lang#121119 (Make `async Fn` trait kind errors better)
 - rust-lang#121141 (Fix closure kind docs)
 - rust-lang#121145 (Update aarch64 target feature docs to match LLVM)
 - rust-lang#121146 (Only point out non-diverging arms for match suggestions)
 - rust-lang#121147 (Avoid debug logging entire MIR body)
 - rust-lang#121155 (doc: add note about panicking examples for strict_overflow_ops)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a7e486a into rust-lang:master Feb 16, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2024
Rollup merge of rust-lang#121095 - chenyukang:yukang-fix-120998-rust-playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add format indent for generated code link with rust-playground
4 participants