diff options
author | BlackDex <[email protected]> | 2023-04-30 17:18:12 +0200 |
---|---|---|
committer | BlackDex <[email protected]> | 2023-04-30 17:18:12 +0200 |
commit | f906f6230a8308a3b60d0bac49f99244b7c89df9 (patch) | |
tree | 19aed5a0cbefada1da16eb9d98b39679e43611e4 /src/api/web.rs | |
parent | 951ba5512330d34b633a5e6692935c594b40575a (diff) | |
download | vaultwarden-f906f6230a8308a3b60d0bac49f99244b7c89df9.tar.gz vaultwarden-f906f6230a8308a3b60d0bac49f99244b7c89df9.zip |
Change `String` to `&str` for all Rocket functions
During setting the latest commit hash for Rocket and updating all the
other crates, there were some messages regarding the usage of `String`
for the Rocket endpoint function calls. I acted upon this message and
changed all `String` types to `&str` and modified the code where needed.
This ended up in less alloc calls, and probably also a bit less memory usage.
- Updated all the crates and commit hashes
- Modified all `String` to `&str` where applicable
Diffstat (limited to 'src/api/web.rs')
-rw-r--r-- | src/api/web.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/web.rs b/src/api/web.rs index f447fb82..abe2b5b9 100644 --- a/src/api/web.rs +++ b/src/api/web.rs @@ -111,8 +111,8 @@ fn alive_head(_conn: DbConn) -> EmptyResult { } #[get("/vw_static/<filename>")] -pub fn static_files(filename: String) -> Result<(ContentType, &'static [u8]), Error> { - match filename.as_ref() { +pub fn static_files(filename: &str) -> Result<(ContentType, &'static [u8]), Error> { + match filename { "404.png" => Ok((ContentType::PNG, include_bytes!("../static/images/404.png"))), "mail-github.png" => Ok((ContentType::PNG, include_bytes!("../static/images/mail-github.png"))), "logo-gray.png" => Ok((ContentType::PNG, include_bytes!("../static/images/logo-gray.png"))), |