Skip to content

Commit

Permalink
style: improve code formatting with cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
yinho999 committed Jan 9, 2025
1 parent 373e041 commit 7be8511
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 14 deletions.
8 changes: 4 additions & 4 deletions loco-new/tests/assertion/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub fn assert_contains(content: &str, expected: &str) {

assert!(
content_sanitized.contains(&expected_sanitized),
"Assertion failed: The content did not contain the expected string. \
Expected: '{expected_sanitized}', content:\n{content_sanitized}"
"Assertion failed: The content did not contain the expected string. Expected: \
'{expected_sanitized}', content:\n{content_sanitized}"
);
}

Expand All @@ -46,7 +46,7 @@ pub fn assert_not_contains(content: &str, unexpected: &str) {

assert!(
!content_sanitized.contains(&unexpected_sanitized),
"Assertion failed: The content unexpectedly contained the string. \
Unexpected: '{unexpected_sanitized}', content:\n{content_sanitized}"
"Assertion failed: The content unexpectedly contained the string. Unexpected: \
'{unexpected_sanitized}', content:\n{content_sanitized}"
);
}
8 changes: 6 additions & 2 deletions loco-new/tests/assertion/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ pub fn assert_path_value_eq_excluded(
);
let mut actual = actual.unwrap().clone();
let actual = remove_value_at_path(&mut actual, excluded);
assert_ne!(actual, Some(expected.clone()), "Assertion failed: Path {path:?} does not match expected value. Expected: {expected:?}, \
Actual: {actual:?}");
assert_ne!(
actual,
Some(expected.clone()),
"Assertion failed: Path {path:?} does not match expected value. Expected: {expected:?}, \
Actual: {actual:?}"
);
}

// pub fn assert_path_value_eq_mapping(yml: &Value, path: &[&str], expected:
Expand Down
3 changes: 2 additions & 1 deletion loco-new/tests/wizard/new.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::{collections::HashMap, path::PathBuf, process::Output, sync::Arc};

use duct::cmd;
use loco::{
generator::{executer::FileSystem, Generator},
settings,
wizard::{self, AssetsOption, BackgroundOption, DBOption},
OS,
};
use std::{collections::HashMap, path::PathBuf, process::Output, sync::Arc};

#[cfg(feature = "test-wizard")]
#[rstest::rstest]
Expand Down
7 changes: 4 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ pub trait Hooks: Send {
Ok(false)
}

/// Loads the configuration settings for the application based on the given environment.
/// Loads the configuration settings for the application based on the given
/// environment.
///
/// This function is responsible for retrieving the configuration for the application
/// based on the current environment.
/// This function is responsible for retrieving the configuration for the
/// application based on the current environment.
async fn load_config(env: &Environment) -> Result<Config> {
env.load()
}
Expand Down
3 changes: 1 addition & 2 deletions src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use crate::{
app::{AppContext, Hooks},
banner::print_banner,
bgworker, cache,
config::Config,
config::{self, WorkerMode},
config::{self, Config, WorkerMode},
controller::ListRoutes,
environment::Environment,
errors::Error,
Expand Down
3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ After running the migration, follow these steps to complete the process:
kind: DeploymentKind,
},

/// Override templates and allows you to take control of them. You can always go back when deleting the local template.
/// Override templates and allows you to take control of them. You can
/// always go back when deleting the local template.
#[command(after_help = format!("{}
- Override a Specific File:
* cargo loco generate override scaffold/api/controller.t
Expand Down
3 changes: 2 additions & 1 deletion src/request_context/driver/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ mod test {
let same_site = cookie.same_site() == Some(same_site);
let path = cookie.path() == Some(config.path.as_str());
let domain = cookie.domain() == config.domain.as_deref();
let max_age = cookie.max_age() == config.expiry.map(|e| time::Duration::seconds(i64::from(e)));
let max_age =
cookie.max_age() == config.expiry.map(|e| time::Duration::seconds(i64::from(e)));
// print out the cookie details if any check failed

cookie.name() == config.name
Expand Down

0 comments on commit 7be8511

Please sign in to comment.