Skip to content

Commit

Permalink
change the lint warning fix way
Browse files Browse the repository at this point in the history
  • Loading branch information
Pana committed Jan 7, 2025
1 parent d99ea67 commit 833eefc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ rustc-hex = { version = "2.1.0", default-features = false }
opt-level = 'z'
lto = true

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }

[features]
default = ["pending_review_screen"]
pending_review_screen = []
Expand All @@ -45,3 +42,6 @@ icon = "icons/cfx_32.gif"

[package.metadata.ledger.flex]
icon = "icons/cfx_40.gif"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("stax", "flex", "nanos", "nanox", "nanosplus"))'] }
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#![no_std]
#![no_main]
#![allow(static_mut_refs)]
#![allow(unexpected_cfgs)]

mod utils;
mod app_ui {
Expand Down
12 changes: 8 additions & 4 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ impl Settings {
#[inline(never)]
#[allow(unused)]
pub fn get_mut(&mut self) -> &mut AtomicStorage<[u8; SETTINGS_SIZE]> {
unsafe { DATA.get_mut() }
let data = &raw mut DATA;
unsafe { (*data).get_mut() }
}

#[inline(never)]
#[allow(unused)]
pub fn get_ref(&mut self) -> &AtomicStorage<[u8; SETTINGS_SIZE]> {
unsafe { DATA.get_ref() }
let data = &raw const DATA;
unsafe { (*data).get_ref() }
}

#[allow(unused)]
pub fn get_element(&self, index: usize) -> Result<u8, AppSW> {
if index >= SETTINGS_SIZE {
return Err(AppSW::InternalError);
}
let storage = unsafe { DATA.get_ref() };
let data = &raw const DATA;
let storage = unsafe { (*data).get_ref() };
let settings = storage.get_ref();
Ok(settings[index])
}
Expand All @@ -46,7 +49,8 @@ impl Settings {
if index >= SETTINGS_SIZE {
return Err(AppSW::InternalError);
}
let storage = unsafe { DATA.get_mut() };
let data = &raw mut DATA;
let storage = unsafe { (*data).get_mut() };
let mut updated_data = *storage.get_ref();
updated_data[index] = value;
storage.update(&updated_data);
Expand Down

0 comments on commit 833eefc

Please sign in to comment.