mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
strip doc comments
This commit is contained in:
parent
7508d53a9b
commit
b8148e0bc9
1 changed files with 8 additions and 3 deletions
|
@ -79,12 +79,12 @@ impl CommandAttrs {
|
||||||
|
|
||||||
fn join_string(
|
fn join_string(
|
||||||
opt: &mut Option<(String, Span)>,
|
opt: &mut Option<(String, Span)>,
|
||||||
new_str: String,
|
new_str: &str,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match opt {
|
match opt {
|
||||||
slot @ None => {
|
slot @ None => {
|
||||||
*slot = Some((new_str, sp));
|
*slot = Some((new_str.to_owned(), sp));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Some((old_str, _)) => {
|
Some((old_str, _)) => {
|
||||||
|
@ -96,7 +96,12 @@ impl CommandAttrs {
|
||||||
|
|
||||||
match attr.kind {
|
match attr.kind {
|
||||||
Prefix(p) => insert(&mut this.prefix, p, attr.sp),
|
Prefix(p) => insert(&mut this.prefix, p, attr.sp),
|
||||||
Description(d) => join_string(&mut this.description, d, attr.sp),
|
Description(d) => join_string(
|
||||||
|
&mut this.description,
|
||||||
|
// Sometimes doc comments include a space before them, this removes it
|
||||||
|
d.strip_prefix(' ').unwrap_or(&d),
|
||||||
|
attr.sp,
|
||||||
|
),
|
||||||
RenameRule(r) => insert(&mut this.rename_rule, r, attr.sp),
|
RenameRule(r) => insert(&mut this.rename_rule, r, attr.sp),
|
||||||
Rename(r) => insert(&mut this.rename, r, attr.sp),
|
Rename(r) => insert(&mut this.rename, r, attr.sp),
|
||||||
ParseWith(p) => insert(&mut this.parser, p, attr.sp),
|
ParseWith(p) => insert(&mut this.parser, p, attr.sp),
|
||||||
|
|
Loading…
Reference in a new issue