Skip to content

Commit

Permalink
Fix variant name interpolation in documentation for IsVariant (#360)
Browse files Browse the repository at this point in the history
Resolves #357 

## Synopsis

Generated documentation is incorrect, see issue

## Solution

Ensure `stringify!` happens after `quote!` interpolation
  • Loading branch information
alpha-tango-kilo committed May 25, 2024
1 parent c70cc34 commit f5a9199
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
([#297](https://github.com/JelteF/derive_more/pull/297))
- Hygiene of macro expansions in presence of custom `core` crate.
([#327](https://github.com/JelteF/derive_more/pull/327))
- Fix documentation of generated methods in `IsVariant` derive.

## 0.99.10 - 2020-09-11

Expand Down
3 changes: 1 addition & 2 deletions impl/src/is_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStre
Fields::Unnamed(_) => quote! { (..) },
Fields::Unit => quote! {},
};
let variant_name = stringify!(variant_ident);
let func = quote! {
#[doc = "Returns `true` if this value is of type `"]
#[doc = #variant_name]
#[doc = stringify!(#variant_ident)]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
Expand Down

0 comments on commit f5a9199

Please sign in to comment.