Skip to content

Commit

Permalink
Put doc cfg on extra-traits impls
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 21, 2020
1 parent 82777db commit 99be307
Show file tree
Hide file tree
Showing 11 changed files with 746 additions and 0 deletions.
1 change: 1 addition & 0 deletions codegen/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {

quote! {
#cfg_features
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl Debug for #ident {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
#body
Expand Down
2 changes: 2 additions & 0 deletions codegen/src/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {

let eq = quote! {
#cfg_features
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl Eq for #ident {}
};

Expand All @@ -132,6 +133,7 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {
#eq

#cfg_features
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for #ident {
fn eq(&self, #other: &Self) -> bool {
#body
Expand Down
1 change: 1 addition & 0 deletions codegen/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {

quote! {
#cfg_features
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl Hash for #ident {
fn hash<H>(&self, #state: &mut H)
where
Expand Down
Loading

0 comments on commit 99be307

Please sign in to comment.