mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Keep the \n
in the doc
comment as it is (don't replace it to newline)
This commit is contained in:
parent
4fe40f48b1
commit
9545075023
2 changed files with 4 additions and 4 deletions
|
@ -154,7 +154,7 @@ pub(crate) fn parse_doc_comment(attr: &Attribute) -> Option<String> {
|
||||||
if let syn::Meta::NameValue(syn::MetaNameValue { lit: syn::Lit::Str(s), .. }) =
|
if let syn::Meta::NameValue(syn::MetaNameValue { lit: syn::Lit::Str(s), .. }) =
|
||||||
attr.parse_meta().ok()?
|
attr.parse_meta().ok()?
|
||||||
{
|
{
|
||||||
return Some(s.value().trim().replace(r"\n", "\n"));
|
return Some(s.value().trim().to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
|
@ -250,7 +250,7 @@ fn description_with_doc_attr() {
|
||||||
enum DefaultCommands {
|
enum DefaultCommands {
|
||||||
/// Start command
|
/// Start command
|
||||||
Start,
|
Start,
|
||||||
/// Help command\nwith new line
|
/// Help command\nwithout replace the `\n`
|
||||||
Help,
|
Help,
|
||||||
/// Foo command
|
/// Foo command
|
||||||
/// with new line
|
/// with new line
|
||||||
|
@ -259,8 +259,8 @@ fn description_with_doc_attr() {
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
DefaultCommands::descriptions().to_string(),
|
DefaultCommands::descriptions().to_string(),
|
||||||
"/start — Start command\n/help — Help command\nwith new line\n/foo — Foo command\nwith \
|
"/start — Start command\n/help — Help command\\nwithout replace the `\\n`\n/foo — Foo \
|
||||||
new line"
|
command\nwith new line"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue