chore: Internal refactor to remove repeitition (#1144)

This commit is contained in:
bouzuya
2022-11-30 14:32:49 -05:00
committed by GitHub
parent 5c8a5d709c
commit 95e8c8bdbb
3 changed files with 20 additions and 17 deletions
+15 -1
View File
@@ -197,6 +197,20 @@ impl Attributes {
}
}
fn format_method_name<T: Service>(
package: &str,
service: &T,
method: &<T as Service>::Method,
) -> String {
format!(
"{}{}{}.{}",
package,
if package.is_empty() { "" } else { "." },
service.identifier(),
method.identifier()
)
}
// Generates attributes given a list of (`pattern`, `attribute`) pairs. If `pattern` matches `name`, `attribute` will be included.
fn generate_attributes<'a>(
name: &str,
@@ -218,7 +232,7 @@ fn generate_attributes<'a>(
fn generate_doc_comment<S: AsRef<str>>(comment: S) -> TokenStream {
let comment = comment.as_ref();
let comment = if !comment.starts_with(" ") {
let comment = if !comment.starts_with(' ') {
format!(" {}", comment)
} else {
comment.to_string()