File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
schemars/tests/integration Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ fn transparent_struct() {
1818#[ serde( transparent) ]
1919/// A doc comment
2020pub struct TransparentStructWithDoc {
21+ /// Another doc comment (ignored)
2122 inner : String ,
2223}
2324
Original file line number Diff line number Diff line change @@ -183,13 +183,18 @@ impl CommonAttrs {
183183 let mut title = self . title . as_ref ( ) . map ( ToTokens :: to_token_stream) ;
184184 let mut description = self . description . as_ref ( ) . map ( ToTokens :: to_token_stream) ;
185185 if let Some ( doc) = & self . doc {
186- if title. is_none ( ) || description. is_none ( ) {
187- mutators. push ( quote ! {
188- const title_and_description: ( & str , & str ) = schemars:: _private:: get_title_and_description( #doc) ;
189- } ) ;
190- title. get_or_insert_with ( || quote ! ( title_and_description. 0 ) ) ;
191- description. get_or_insert_with ( || quote ! ( title_and_description. 1 ) ) ;
192- }
186+ title. get_or_insert_with ( || {
187+ quote ! ( {
188+ const TITLE : & str = schemars:: _private:: get_title_and_description( #doc) . 0 ;
189+ TITLE
190+ } )
191+ } ) ;
192+ description. get_or_insert_with ( || {
193+ quote ! ( {
194+ const DESCRIPTION : & str = schemars:: _private:: get_title_and_description( #doc) . 1 ;
195+ DESCRIPTION
196+ } )
197+ } ) ;
193198 }
194199 if let Some ( title) = title {
195200 mutators. push ( quote ! {
You can’t perform that action at this time.
0 commit comments