more things

This commit is contained in:
nora 2022-03-04 23:05:50 +01:00
parent 5d127eceee
commit b6355f5e35
11 changed files with 129 additions and 122 deletions

View file

@ -305,7 +305,7 @@ pub struct {class_name}{method_name}"
use heck::ToSnakeCase;
if ident == "type" {
"r#type".to_string()
"r#type".to_owned()
} else {
ident.to_snake_case()
}
@ -336,7 +336,7 @@ pub struct {class_name}{method_name}"
fn invariants<'a>(&self, asserts: impl Iterator<Item = &'a Assert>) -> String {
asserts
.map(|assert| match &*assert.check {
"notnull" => "must not be null".to_string(),
"notnull" => "must not be null".to_owned(),
"length" => format!("must be shorter than {}", assert.value.as_ref().unwrap()),
"regexp" => format!("must match `{}`", assert.value.as_ref().unwrap()),
"le" => {
@ -354,7 +354,7 @@ pub struct {class_name}{method_name}"
fn doc_comment(&mut self, docs: &[Doc], indent: usize) {
for doc in docs {
if doc.kind == Some("grammar".to_string()) {
if doc.kind == Some("grammar".to_owned()) {
continue;
}
for line in doc.text.lines() {

View file

@ -11,7 +11,7 @@ use crate::error::TransError;
use crate::methods::write_helper::*;
use std::io::Write;
pub fn write_method<W: Write>(method: Method, mut writer: W) -> Result<(), TransError> {{
pub fn write_method<W: Write>(method: &Method, mut writer: W) -> Result<(), TransError> {{
match method {{"
)
.ok();