From 0de17d7832c6e4ffbc11f6b93ef2d6578ace9002 Mon Sep 17 00:00:00 2001 From: Kevin Kuriakose Date: Wed, 22 Dec 2021 00:39:25 +0530 Subject: [PATCH] Add doc comments for Unwrap, IsVariant Prevents a linting issue from `missing_docs` on the derived functions --- src/is_variant.rs | 3 +++ src/unwrap.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/is_variant.rs b/src/is_variant.rs index 3f192982..80781dc1 100644 --- a/src/is_variant.rs +++ b/src/is_variant.rs @@ -42,6 +42,9 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result quote! {}, }; let func = quote! { + #[doc = "Returns `true` if this value is of type `"] + #[doc = stringify!(#variant_ident)] + #[doc = "`. Returns false otherwise"] pub fn #fn_name(&self) -> bool { match self { #enum_name ::#variant_ident #data_pattern => true, diff --git a/src/unwrap.rs b/src/unwrap.rs index e2243d3a..206f0c8d 100644 --- a/src/unwrap.rs +++ b/src/unwrap.rs @@ -81,6 +81,9 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result #ret_type { match self { #enum_name ::#variant_ident #data_pattern => #ret_value,