remove extra copy

This commit is contained in:
yggverse 2025-07-26 07:51:41 +03:00
parent 8df429e98f
commit 5e32113747
3 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ impl Misc {
// update values from the DB (if exists) // update values from the DB (if exists)
for row in rows { for row in rows {
assert!(!m.insert(Memory::from_db_row(&row.key, row.value.as_deref()).unwrap())) assert!(!m.insert(Memory::from_db_row(&row.key, row.value).unwrap()))
// * panics if the DB was malformed or changed unexpectedly // * panics if the DB was malformed or changed unexpectedly
} }
} }

View file

@ -13,7 +13,7 @@ pub enum Memory {
impl Memory { impl Memory {
// Constructors // Constructors
pub fn from_db_row(key: &str, value: Option<&str>) -> Option<Self> { pub fn from_db_row(key: &str, value: Option<String>) -> Option<Self> {
if key == HIGHLIGHT_REQUEST_ENTRY { if key == HIGHLIGHT_REQUEST_ENTRY {
Some(Self::HighlightRequestEntry(Bool::from_db_value(value))) Some(Self::HighlightRequestEntry(Bool::from_db_value(value)))
} else { } else {

View file

@ -13,7 +13,7 @@ impl Bool {
if value { Self::True } else { Self::False } if value { Self::True } else { Self::False }
} }
pub fn from_db_value(key: Option<&str>) -> Self { pub fn from_db_value(key: Option<String>) -> Self {
if key.is_some_and(|k| k == TRUE) { if key.is_some_and(|k| k == TRUE) {
Self::True Self::True
} else { } else {