Address review comments

This commit is contained in:
DataTriny 2023-08-15 20:56:13 +02:00
parent f02fe9478d
commit 1a73ce6e60
2 changed files with 5 additions and 5 deletions

View File

@ -397,7 +397,7 @@ impl<'a> PyClassEnumVariant<'a> {
.unwrap_or_else(|| {
let name = self.ident.unraw();
if let Some(attr) = &args.options.rename_all {
let new_name = apply_renaming_rule(attr.value.rule, &format!("{}", name));
let new_name = apply_renaming_rule(attr.value.rule, &name.to_string());
Cow::Owned(Ident::new(&new_name, Span::call_site()))
} else {
Cow::Owned(name)

View File

@ -745,12 +745,12 @@ impl PropertyType<'_> {
let name = match (python_name, &field.ident) {
(Some(name), _) => name.value.0.to_string(),
(None, Some(field_name)) => {
let name = format!("{}\0", field_name.unraw());
let mut name = field_name.unraw().to_string();
if let Some(rule) = renaming_rule {
utils::apply_renaming_rule(*rule, &name)
} else {
name
name = utils::apply_renaming_rule(*rule, &name);
}
name.push('\0');
name
}
(None, None) => {
bail_spanned!(field.span() => "`get` and `set` with tuple struct fields require `name`");