File tree 1 file changed +8
-14
lines changed
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
296
296
} )
297
297
}
298
298
299
+ // extract doc line from attribute
299
300
fn extract_doc_line ( attr : & syn:: Attribute ) -> Option < String > {
300
301
if !attr. path ( ) . is_ident ( "doc" ) {
301
302
return None ;
302
303
}
303
304
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 ;
307
307
} ;
308
308
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 ;
312
311
} ;
313
312
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 ;
317
315
} ;
318
316
319
317
let content = lit_str. value ( ) . trim ( ) . to_string ( ) ;
320
318
321
- if content. is_empty ( ) {
322
- None
323
- } else {
324
- Some ( content)
325
- }
319
+ ( !content. is_empty ( ) ) . then_some ( content)
326
320
}
327
321
328
322
pub ( 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