File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ panic = 'abort'
67
67
[profile .dev ]
68
68
panic = ' abort'
69
69
70
+ [lints .rust ]
71
+ unsafe_code = " deny"
72
+
70
73
[lints .clippy ]
71
74
wildcard_dependencies = " deny"
72
75
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ pub struct PriceEntry {
86
86
87
87
impl From < SolanaPriceAccount > for PriceEntry {
88
88
fn from ( other : SolanaPriceAccount ) -> PriceEntry {
89
+ #[ allow( unsafe_code, reason = "for tests only" ) ]
89
90
unsafe {
90
91
// NOTE: We know the size is 32 because It's a Solana account. This is for tests only.
91
92
let comp_mem = std:: slice:: from_raw_parts ( other. comp . as_ptr ( ) , 32 ) ;
@@ -102,6 +103,7 @@ impl PriceEntry {
102
103
/// Construct the right underlying GenericPriceAccount based on the account size.
103
104
#[ instrument( skip( acc) ) ]
104
105
pub fn load_from_account ( acc : & [ u8 ] ) -> Option < Self > {
106
+ #[ allow( unsafe_code, reason = "optimization" ) ]
105
107
unsafe {
106
108
let size = match acc. len ( ) {
107
109
n if n == std:: mem:: size_of :: < SolanaPriceAccount > ( ) => 32 ,
You can’t perform that action at this time.
0 commit comments