fix docstring

This commit is contained in:
2025-11-14 20:25:42 +00:00
parent fbbb93f86b
commit 59aa99ced9
+7 -3
View File
@@ -343,9 +343,13 @@ fn extract_docstring(attrs: &[Attribute]) -> Option<String> {
// #[doc = "…"]
if let Ok(meta) = attr.parse_meta() {
if let syn::Meta::NameValue(nv) = meta {
// The field is `value`, not `lit`
if let syn::Lit::Str(lit) = nv.value {
docs.push(lit.value());
// The value is an `Expr`. Pull out a string literal.
if let syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Str(lit_str),
..
}) = nv.value
{
docs.push(lit_str.value());
}
}
}