Jelajahi Sumber

Apply suggestions from code review

Armani Ferrante 3 tahun lalu
induk
melakukan
707f51f885

+ 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> {
                         // Header is always 8 bytes.
                         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);
                         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]);
                 let __header = u64::from_le_bytes(__header_bytes);
                 if __header != 0 {
-                    return Err(anchor_lang::__private::ErrorCode::ConstraintZero.into());
+                    return Err(anchor_lang::error::ErrorCode::ConstraintZero.into());
                 }
 
                 #header_write