Skip to content

Commit 548e2e9

Browse files
committed
oops, added back unsafe check
1 parent 3744141 commit 548e2e9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ panic = 'abort'
6767
[profile.dev]
6868
panic = 'abort'
6969

70+
[lints.rust]
71+
unsafe_code = "deny"
72+
7073
[lints.clippy]
7174
wildcard_dependencies = "deny"
7275

src/agent/state/oracle.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub struct PriceEntry {
8686

8787
impl From<SolanaPriceAccount> for PriceEntry {
8888
fn from(other: SolanaPriceAccount) -> PriceEntry {
89+
#[allow(unsafe_code, reason = "for tests only")]
8990
unsafe {
9091
// NOTE: We know the size is 32 because It's a Solana account. This is for tests only.
9192
let comp_mem = std::slice::from_raw_parts(other.comp.as_ptr(), 32);
@@ -102,6 +103,7 @@ impl PriceEntry {
102103
/// Construct the right underlying GenericPriceAccount based on the account size.
103104
#[instrument(skip(acc))]
104105
pub fn load_from_account(acc: &[u8]) -> Option<Self> {
106+
#[allow(unsafe_code, reason = "optimization")]
105107
unsafe {
106108
let size = match acc.len() {
107109
n if n == std::mem::size_of::<SolanaPriceAccount>() => 32,

0 commit comments

Comments
 (0)