浏览代码

Apply suggestions from code review

Armani Ferrante 3 年之前
父节点
当前提交
707f51f885
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      lang/attribute/account/src/lib.rs
  2. 1 1
      lang/syn/src/codegen/accounts/constraints.rs

+ 1 - 1
lang/attribute/account/src/lib.rs

@@ -152,7 +152,7 @@ pub fn account(
                     fn try_deserialize(buf: &mut &[u8]) -> std::result::Result<Self, ProgramError> {
                     fn try_deserialize(buf: &mut &[u8]) -> std::result::Result<Self, ProgramError> {
                         // Header is always 8 bytes.
                         // Header is always 8 bytes.
                         if buf.len() < anchor_lang::accounts::header::HEADER_LEN {
                         if buf.len() < anchor_lang::accounts::header::HEADER_LEN {
-                            return Err(anchor_lang::__private::ErrorCode::AccountDiscriminatorNotFound.into());
+                            return Err(anchor_lang::error::ErrorCode::AccountDiscriminatorNotFound.into());
                         }
                         }
                         let given_disc = anchor_lang::accounts::header::read_discriminator(&buf);
                         let given_disc = anchor_lang::accounts::header::read_discriminator(&buf);
                         if &#discriminator != given_disc {
                         if &#discriminator != given_disc {

+ 1 - 1
lang/syn/src/codegen/accounts/constraints.rs

@@ -162,7 +162,7 @@ pub fn generate_constraint_zeroed(f: &Field, _c: &ConstraintZeroed) -> proc_macr
                 __header_bytes.copy_from_slice(&__data[..8]);
                 __header_bytes.copy_from_slice(&__data[..8]);
                 let __header = u64::from_le_bytes(__header_bytes);
                 let __header = u64::from_le_bytes(__header_bytes);
                 if __header != 0 {
                 if __header != 0 {
-                    return Err(anchor_lang::__private::ErrorCode::ConstraintZero.into());
+                    return Err(anchor_lang::error::ErrorCode::ConstraintZero.into());
                 }
                 }
 
 
                 #header_write
                 #header_write