Skip to content

Commit

Permalink
cargo +nightly fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Nov 28, 2024
1 parent 8bb39b3 commit 1f4cc8f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
12 changes: 7 additions & 5 deletions src/cache/drivers/inmem.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! # In-Memory Cache Driver
//!
//! This module implements a cache driver using an in-memory cache.
use std::sync::Arc;
use std::time::{Duration, Instant};
use std::{
sync::Arc,
time::{Duration, Instant},
};

use async_trait::async_trait;
use moka::sync::Cache;
use moka::Expiry;
use moka::{sync::Cache, Expiry};

use super::CacheDriver;
use crate::cache::CacheResult;
Expand Down Expand Up @@ -81,7 +82,8 @@ impl CacheDriver for Inmem {
Ok(())
}

/// Inserts a key-value pair into the cache that expires after the specified number of seconds.
/// Inserts a key-value pair into the cache that expires after the specified
/// number of seconds.
///
/// # Errors
///
Expand Down
3 changes: 2 additions & 1 deletion src/cache/drivers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! # Cache Drivers Module
//!
//! This module defines traits and implementations for cache drivers.
use async_trait::async_trait;
use std::time::Duration;

use async_trait::async_trait;

use super::CacheResult;

#[cfg(feature = "cache_inmem")]
Expand Down
3 changes: 2 additions & 1 deletion src/cache/drivers/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
//! framework is initialized. The primary purpose of this driver is to simplify
//! the user workflow by avoiding the need for feature flags or optional cache
//! driver configurations.
use async_trait::async_trait;
use std::time::Duration;

use async_trait::async_trait;

use super::CacheDriver;
use crate::cache::{CacheError, CacheResult};

Expand Down
7 changes: 3 additions & 4 deletions src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//! This module provides a generic cache interface for various cache drivers.
pub mod drivers;

use std::future::Future;
use std::time::Duration;
use std::{future::Future, time::Duration};

use self::drivers::CacheDriver;
use crate::Result as LocoResult;
Expand Down Expand Up @@ -149,8 +148,8 @@ impl Cache {
}

/// Retrieves the value associated with the given key from the cache,
/// or inserts it (with expiry after provided duration) if it does not exist,
/// using the provided closure to generate the value.
/// or inserts it (with expiry after provided duration) if it does not
/// exist, using the provided closure to generate the value.
///
/// # Example
/// ```
Expand Down
9 changes: 6 additions & 3 deletions src/controller/views/tera_builtins/filters/number.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![allow(clippy::implicit_hasher)]
use std::collections::HashMap;

use byte_unit::Byte;
use serde_json::value::Value;
use std::collections::HashMap;
use tera::Result;
use thousands::Separable;

Expand All @@ -25,7 +26,8 @@ pub fn number_with_delimiter(value: &Value, _: &HashMap<String, Value>) -> Resul
}
}

/// Converts a numeric value (in bytes) into a human-readable size string with appropriate units.
/// Converts a numeric value (in bytes) into a human-readable size string with
/// appropriate units.
///
/// # Examples:
///
Expand Down Expand Up @@ -77,9 +79,10 @@ pub fn number_to_percentage(value: &Value, options: &HashMap<String, Value>) ->

#[cfg(test)]
mod tests {
use std::collections::HashMap;

use rstest::rstest;
use serde_json::json;
use std::collections::HashMap;

use super::*;

Expand Down
3 changes: 2 additions & 1 deletion src/mailer/email_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ impl EmailSender {
///
/// # Errors
///
/// When email doesn't send successfully or has an error to build the message
/// When email doesn't send successfully or has an error to build the
/// message
pub async fn mail(&self, email: &Email) -> Result<()> {
let content = MultiPart::alternative_plain_html(email.text.clone(), email.html.clone());
let mut builder = Message::builder()
Expand Down

0 comments on commit 1f4cc8f

Please sign in to comment.