docs(ast): improve formatting of AstBuilder doc comments (#6756)

This commit is contained in:
overlookmotel 2024-10-22 00:12:01 +00:00
parent b8845773f7
commit 46720be7af
2 changed files with 370 additions and 370 deletions

File diff suppressed because it is too large Load diff

View file

@ -285,12 +285,12 @@ fn generate_struct_builder_fn(ty: &StructDef, ctx: &LateCtx) -> TokenStream {
let alloc_fn_name = format_ident!("alloc_{fn_name}"); let alloc_fn_name = format_ident!("alloc_{fn_name}");
let article = article_for(ident.to_string()); let article = article_for(ident.to_string());
let fn_docs = DocComment::new(format!("Build {article} [`{ident}`]")) let fn_docs = DocComment::new(format!("Build {article} [`{ident}`]."))
.with_description(format!("If you want the built node to be allocated in the memory arena, use [`AstBuilder::{alloc_fn_name}`] instead.")) .with_description(format!("If you want the built node to be allocated in the memory arena, use [`AstBuilder::{alloc_fn_name}`] instead."))
.with_params(&params); .with_params(&params);
let alloc_docs = let alloc_docs =
DocComment::new(format!("Build {article} [`{ident}`] and stores it in the memory arena.")) DocComment::new(format!("Build {article} [`{ident}`], and store it in the memory arena."))
.with_description(format!("Returns a [`Box`] containing the newly-allocated node. If you want a stack-allocated node, use [`AstBuilder::{fn_name}`] instead.")) .with_description(format!("Returns a [`Box`] containing the newly-allocated node. If you want a stack-allocated node, use [`AstBuilder::{fn_name}`] instead."))
.with_params(&params); .with_params(&params);