Skip to content

Commit 7923eef

Browse files
Merge branch 'cli-testability-improvements'
2 parents db43309 + 5edf5cd commit 7923eef

19 files changed

Lines changed: 935 additions & 743 deletions

Cargo.lock

Lines changed: 553 additions & 505 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

create-rust-app/src/auth/controller.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,7 @@ pub fn register(
532532
mail::auth_register::send(
533533
mailer,
534534
&user.email,
535-
&format!(
536-
"http://localhost:3000/activate?token={token}",
537-
token = token
538-
),
535+
&format!("http://localhost:3000/activate?token={token}"),
539536
);
540537

541538
Ok(())
@@ -645,10 +642,7 @@ pub fn forgot_password(
645642
)
646643
.unwrap();
647644

648-
let link = &format!(
649-
"http://localhost:3000/reset?token={reset_token}",
650-
reset_token = reset_token
651-
);
645+
let link = &format!("http://localhost:3000/reset?token={reset_token}");
652646
mail::auth_recover_existent_account::send(mailer, &user.email, link);
653647
} else {
654648
let link = &"http://localhost:300/register".to_string();

create-rust-app/src/auth/mail/auth_recover_existent_account.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Someone requested a password reset for the account associated with this email.
1313
Please visit this link to reset your password:
1414
{link}
1515
(valid for 24 hours)
16-
"#,
17-
link = link
16+
"#
1817
);
1918
let html = format!(
2019
r#"
@@ -26,8 +25,7 @@ Someone requested a password reset for the account associated with this email.
2625
Please visit this link to reset your password:
2726
{link}
2827
(valid for 24 hours)
29-
"#,
30-
link = link
28+
"#
3129
);
3230

3331
mailer.send(to_email, subject, &text, &html);

create-rust-app/src/auth/mail/auth_recover_nonexistent_account.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ Hello,
1212
Someone requested a password reset for the account associated with this email, but no account exists!
1313
If this was intentional, you can register for a new account using the link below:
1414
{link}
15-
"#,
16-
link = link
15+
"#
1716
);
1817
let html = format!(
1918
r#"
@@ -24,8 +23,7 @@ Hello,
2423
Someone requested a password reset for the account associated with this email, but no account exists!
2524
If this was intentional, you can register for a new account using the link below:
2625
{link}
27-
"#,
28-
link = link
26+
"#
2927
);
3028

3129
mailer.send(to_email, subject, &text, &html);

create-rust-app/src/auth/mail/auth_register.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Hello,
1111
1212
Please follow the link below to complete your registration:
1313
{link}
14-
"#,
15-
link = link
14+
"#
1615
);
1716
let html = format!(
1817
r#"
@@ -22,8 +21,7 @@ Hello,
2221
2322
Please follow the link below to complete your registration:
2423
{link}
25-
"#,
26-
link = link
24+
"#
2725
);
2826

2927
mailer.send(to_email, subject, &text, &html);

create-rust-app/src/storage/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl Storage {
212212
.map_err(|err| {
213213
self.error_string(
214214
"Could not delete objects",
215-
format!("{:#?}", keys),
215+
format!("{keys:#?}"),
216216
err.to_string(),
217217
)
218218
})?;

create-rust-app/src/util/actix_web_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn render_single_page_application(route: &str, view: &str) -> Scope {
1313
let route = route.strip_prefix('/').unwrap_or(route);
1414
let view = view.strip_prefix('/').unwrap_or(view);
1515

16-
actix_web::web::scope(&format!("/{}{{tail:(/.*)?}}", route))
16+
actix_web::web::scope(&format!("/{route}{{tail:(/.*)?}}"))
1717
.app_data(Data::new(SinglePageApplication {
1818
view_name: view.to_string(),
1919
}))

create-rust-app/src/util/template_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ lazy_static! {
1515
let mut tera = match Tera::new("backend/views/**/*.html") {
1616
Ok(t) => t,
1717
Err(e) => {
18-
println!("Parsing error(s): {}", e);
18+
println!("Parsing error(s): {e}");
1919
::std::process::exit(1);
2020
}
2121
};

create-rust-app_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ console = "0.15.5"
1818
dialoguer = "0.10.3"
1919
indoc = "1.0.8"
2020
rust-embed = "6.4.2"
21-
structopt = "0.3.26"
21+
clap = {version = "4.1", features = ["wrap_help", "derive", "cargo"]}
2222
toml = "0.5.11"
2323
tsync = "1"
2424

create-rust-app_cli/src/content/migration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub fn create(name: &str, up: &str, down: &str) -> Result<()> {
2525
migrations_dir.push(&migration_dir_name);
2626
ensure_directory(&migrations_dir, false)?;
2727

28-
let up_file = PathBuf::from(format!("migrations/{}/up.sql", migration_dir_name));
29-
let down_file = PathBuf::from(format!("migrations/{}/down.sql", migration_dir_name));
28+
let up_file = PathBuf::from(format!("migrations/{migration_dir_name}/up.sql"));
29+
let down_file = PathBuf::from(format!("migrations/{migration_dir_name}/down.sql"));
3030
ensure_file(&up_file, Some(up))?;
3131
ensure_file(&down_file, Some(down))?;
3232

0 commit comments

Comments
 (0)