-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Migrate item_trait_alias
to Askama
#112030
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Thanks! @bors r+ rollup |
📌 Commit 9520f591368f27e39637e7c566d693c7eeaab6e3 has been approved by It is now in the queue for this repository. |
t: &clean::TraitAlias, | ||
) { | ||
let mut buffer = Buffer::new(); | ||
wrap_item(&mut buffer, |buffer| { |
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.
Something I just thought about: is it actually necessary to pass Buffer
as argument to wrap_item
? If we're forced to, would it make sense to have another wrap_item_write
which would take impl fmt::Write
instead?
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 we could actually write another wrap_item_write
that would take in impl fmt::Write and it would actually reduce the overhead of creating a buffer every single time.
fn wrap_item_write<F>(w: &mut impl fmt::Write, f: F)
where
F: FnOnce(&mut impl fmt::Write),
{
write!(w, r#"<pre class="rust item-decl"><code>"#).unwrap();
f(w);
write!(w, "</code></pre>").unwrap();
}
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.
Then please do.
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.
Lets do it in this PR itself and then we can merge the rest, or do you want me to create a new PR to implement that function
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.
You can do it in this PR directly.
Waiting for an answer to my comment. @bors r- |
@GuillaumeGomez Implemented the wrap_item_write, looks like we can get rid of the buffer now. Let me know if you have any suggestions |
@@ -1675,6 +1681,16 @@ where | |||
w.write_str("</code></pre>"); | |||
} | |||
|
|||
fn wrap_item_write<W, F>(w: &mut W, f: F) |
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.
Buffer
actually already implements the fmt::Write
trait. Wouldn't it be simpler to update wrap_item
instead of creating a new function?
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 that makes perfect sense, updated the function : )
Looks like it's all good, thanks for working on this! Once CI pass, r=me |
Implemented wrap_item_write Update wrap_item
e2d24f9
to
780719b
Compare
Could not assign reviewer from: |
No need to re-assign me every time, I get notifications for every event on a PR I'm subscribed to. ;) @bors r+ rollup |
…mpiler-errors Rollup of 7 pull requests Successful merges: - rust-lang#111670 (Require that const param tys implement `ConstParamTy`) - rust-lang#111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - rust-lang#112030 (Migrate `item_trait_alias` to Askama) - rust-lang#112150 (Support 128-bit atomics on all x86_64 Apple targets) - rust-lang#112174 (Fix broken link) - rust-lang#112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - rust-lang#112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - rust-lang#112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Rollup of 7 pull requests Successful merges: - rust-lang#111670 (Require that const param tys implement `ConstParamTy`) - rust-lang#111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - rust-lang#112030 (Migrate `item_trait_alias` to Askama) - rust-lang#112150 (Support 128-bit atomics on all x86_64 Apple targets) - rust-lang#112174 (Fix broken link) - rust-lang#112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - rust-lang#112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - rust-lang#112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
This PR migrates
item_trait_alias
to AskamaRefers #108868