index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-07-01 13:46:50.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-07-01 13:58:28.0 +00:00:00
commit
920acb2888e3ebbef09eb7a3bd220b643233e56c [patch]
tree
95cdb5d8269542e68308eb4c4e0b01a85d5c3bd2
parent
55ffd06be14e74f086a244d25b2c4eca94ba35a5
download
920acb2888e3ebbef09eb7a3bd220b643233e56c.tar.gz

refactor: prefer `to_owned()` for string literals over `to_string()`



Diff

 src/cors.rs    | 2 +-
 src/helpers.rs | 2 +-
 src/server.rs  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cors.rs b/src/cors.rs
index 2014ce8..0992a46 100644
--- a/src/cors.rs
+++ b/src/cors.rs
@@ -121,7 +121,7 @@ impl Cors {

impl Default for Cors {
    fn default() -> Self {
        Self::new("*".to_string())
        Self::new("*".to_owned())
    }
}

diff --git a/src/helpers.rs b/src/helpers.rs
index 63cb0a9..f32ccce 100644
--- a/src/helpers.rs
+++ b/src/helpers.rs
@@ -22,7 +22,7 @@ where
{
    let path = get_valid_dirpath(path)?;
    match path.iter().last() {
        Some(v) => Ok(v.to_str().unwrap().to_string()),
        Some(v) => Ok(v.to_str().unwrap().to_owned()),
        _ => bail!("directory name for path \"{:?}\" was not determined", path),
    }
}
diff --git a/src/server.rs b/src/server.rs
index 6308b39..adf6942 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -105,7 +105,7 @@ impl Server {
        let threads = self.threads;

        // CORS support
        let cors = cors::new(opts.cors_allow_origins.trim().to_string());
        let cors = cors::new(opts.cors_allow_origins.trim().to_owned());

        // Create a service router for Hyper
        let router_service = RouterService::new(RequestHandler {