Skip to content

Commit

Permalink
fix: doc comments breaking server functions (closes #2190) (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored Jan 16, 2024
1 parent 44db400 commit 3f34d9b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server_fn_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ pub fn server_macro_impl(
}

struct ServerFnName {
_attrs: Vec<Attribute>,
struct_name: Ident,
_comma: Option<Token![,]>,
prefix: Option<Literal>,
Expand All @@ -362,6 +363,7 @@ struct ServerFnName {

impl Parse for ServerFnName {
fn parse(input: ParseStream) -> syn::Result<Self> {
let _attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
let struct_name = input.parse()?;
let _comma = input.parse()?;
let prefix = input.parse()?;
Expand All @@ -382,6 +384,7 @@ impl Parse for ServerFnName {
let fn_path = input.parse()?;

Ok(Self {
_attrs,
struct_name,
_comma,
prefix,
Expand Down Expand Up @@ -412,7 +415,7 @@ struct ServerFnBody {
/// The custom rusty variant of parsing rsx!
impl Parse for ServerFnBody {
fn parse(input: ParseStream) -> Result<Self> {
let attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
let mut attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
let vis: Visibility = input.parse()?;

let async_token = input.parse()?;
Expand Down Expand Up @@ -452,6 +455,12 @@ impl Parse for ServerFnBody {
Some((value.unwrap_or_default(), attr.path.span()))
})
.collect();
attrs.retain(|attr| {
let Meta::NameValue(attr) = &attr.meta else {
return true;
};
!attr.path.is_ident("doc")
});

Ok(Self {
vis,
Expand Down

0 comments on commit 3f34d9b

Please sign in to comment.