Skip to content

rustdoc: remove .borrow() calls in Askama templates for ItemTemplate implementors #112021

Closed
@nicklimmm

Description

@nicklimmm

Context:

Would like to hear more ideas to tackle this problem, but this is my proposal (rough idea):

  • Blanket impl of ItemTemplate for references: impl<T: ItemTemplate> ItemTemplate for &T
  • derive macro for ItemTemplate; One might ask, is there a need for macros here?
    • impl<T: ItemTemplate> askama::Template for &T is required
      • Can't apply blanket impl because it involves an external trait
      • So, we are left with implementing this trait for each &T, which can be done by copying the associated types and calling existing methods from T (basically making &T behave the same as T)

I suspect that we can gain more by creating macros here, but it is still under exploration.

cc @GuillaumeGomez

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions