From 28c428b8a37fe6607fb50d96fbbb9263433bacb5 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 29 Dec 2024 22:51:42 +0100 Subject: Minor cleanup Let auth::stage() deal with having to clone the string It shouldn't force the caller to create a String object. --- server/src/auth.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/src/auth.rs') diff --git a/server/src/auth.rs b/server/src/auth.rs index 4e66448..7cb2d54 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -237,7 +237,8 @@ fn unauthorized() -> Json { Json(STATUS_UNAUTHORIZED) } -pub fn stage(basepath: String) -> AdHoc { +pub fn stage(basepath: &str) -> AdHoc { + let l_basepath = basepath.to_string(); AdHoc::on_ignite("Auth Stage", |rocket| async { rocket .manage(Sessions { @@ -247,7 +248,7 @@ pub fn stage(basepath: String) -> AdHoc { }), }) .attach(AdHoc::config::()) - .mount(basepath.clone(), routes![login, logout, status]) - .register(basepath, catchers![unauthorized]) + .mount(l_basepath.clone(), routes![login, logout, status]) + .register(l_basepath, catchers![unauthorized]) }) } -- cgit v1.2.3-70-g09d2