chore (backend-rs): apply clippy fixes

This commit is contained in:
naskya 2024-08-02 00:41:51 +09:00
parent 2b31b55cf3
commit dc2b452e5a
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -13,6 +13,12 @@ struct TimedData<T: Clone> {
last_updated: DateTime<Utc>,
}
impl<T: Clone> Default for Cache<T> {
fn default() -> Self {
Self::new()
}
}
impl<T: Clone> Cache<T> {
pub const fn new() -> Self {
Self {
@ -36,10 +42,7 @@ impl<T: Clone> Cache<T> {
pub fn set(&self, value: T) {
if self.ttl.is_none() {
let _ = self
.cache
.lock()
.map(|mut cache| (*cache).value = Some(value));
let _ = self.cache.lock().map(|mut cache| cache.value = Some(value));
} else {
let _ = self.cache.lock().map(|mut cache| {
*cache = TimedData {