@@ -445,14 +445,12 @@ void ConverterRefCount::AddCloneTrait(const clang::RecordDecl *decl) {
445445 auto record_name = GetRecordName (decl);
446446
447447 if (decl->isUnion ()) {
448- StrCat (std::format ( " impl Clone for {} " , record_name) );
448+ StrCat (" impl Clone for" , record_name);
449449 PushBrace impl_brace (*this );
450450 StrCat (" fn clone(&self) -> Self" );
451451 PushBrace fn_brace (*this );
452- StrCat (
453- std::format (" {} {{ __bytes: "
454- " Rc::new(RefCell::new(self.__bytes.borrow().clone())) }}" ,
455- record_name));
452+ StrCat (record_name,
453+ " { __bytes: Rc::new(RefCell::new(self.__bytes.borrow().clone())) }" );
456454 return ;
457455 }
458456
@@ -483,14 +481,13 @@ void ConverterRefCount::AddDefaultTrait(const clang::RecordDecl *decl) {
483481
484482void ConverterRefCount::AddDefaultTraitForUnion (const clang::RecordDecl *decl) {
485483 auto name = GetRecordName (decl);
486- StrCat (std::format ( " impl Default for {} " , name) );
484+ StrCat (" impl Default for" , name);
487485 PushBrace impl_brace (*this );
488486 StrCat (" fn default() -> Self" );
489487 PushBrace fn_brace (*this );
490- StrCat (std::format (" {} {{ __bytes: Rc::new(RefCell::new(vec![0u8; "
491- " {}].into_boxed_slice())) }}" ,
492- name,
493- ctx_.getASTRecordLayout (decl).getSize ().getQuantity ()));
488+ StrCat (std::format (
489+ " {} {{ __bytes: Rc::new(RefCell::new(Box::from([0u8; {}]))) }}" , name,
490+ ctx_.getASTRecordLayout (decl).getSize ().getQuantity ()));
494491}
495492
496493void ConverterRefCount::EmitRustUnion (clang::RecordDecl *decl) {
@@ -502,7 +499,7 @@ void ConverterRefCount::EmitRustUnion(clang::RecordDecl *decl) {
502499
503500 StrCat (std::format (" pub struct {} {{ __bytes: Value<Box<[u8]>> }}" , name));
504501
505- StrCat (std::format ( " impl {} " , name) );
502+ StrCat (" impl" , name);
506503 {
507504 PushBrace impl_brace (*this );
508505 for (auto *field : decl->fields ()) {
0 commit comments