File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -296,33 +296,27 @@ pub(crate) fn tool_impl_item(attr: TokenStream, mut input: ItemImpl) -> syn::Res
296296 } )
297297}
298298
299+ // extract doc line from attribute
299300fn extract_doc_line ( attr : & syn:: Attribute ) -> Option < String > {
300301 if !attr. path ( ) . is_ident ( "doc" ) {
301302 return None ;
302303 }
303304
304- let name_value = match & attr. meta {
305- syn:: Meta :: NameValue ( nv) => nv,
306- _ => return None ,
305+ let syn:: Meta :: NameValue ( name_value) = & attr. meta else {
306+ return None ;
307307 } ;
308308
309- let expr_lit = match & name_value. value {
310- syn:: Expr :: Lit ( lit) => lit,
311- _ => return None ,
309+ let syn:: Expr :: Lit ( expr_lit) = & name_value. value else {
310+ return None ;
312311 } ;
313312
314- let lit_str = match & expr_lit. lit {
315- syn:: Lit :: Str ( s) => s,
316- _ => return None ,
313+ let syn:: Lit :: Str ( lit_str) = & expr_lit. lit else {
314+ return None ;
317315 } ;
318316
319317 let content = lit_str. value ( ) . trim ( ) . to_string ( ) ;
320318
321- if content. is_empty ( ) {
322- None
323- } else {
324- Some ( content)
325- }
319+ ( !content. is_empty ( ) ) . then_some ( content)
326320}
327321
328322pub ( crate ) fn tool_fn_item ( attr : TokenStream , mut input_fn : ItemFn ) -> syn:: Result < TokenStream > {
You can’t perform that action at this time.
0 commit comments