From ee9d44fc6032857ceffdd54bf3fb4b3c3600f5cf Mon Sep 17 00:00:00 2001 From: Tuyen Pham Date: Sat, 13 Aug 2022 15:09:06 +0700 Subject: [PATCH] [*] Update port config --- src/cmd/serve.rs | 6 +++--- src/config.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 4a249b9e..33993fd1 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -63,13 +63,13 @@ pub fn execute(args: &ArgMatches) -> Result<()> { let hostname: String = match (args.value_of("hostname"), &book.config.serve.hostname) { (Some(h), _) => h.to_owned(), (_, Some(h)) => h.to_owned(), - (_, _) => "localhost".to_owned(), + (_, _) => String::from("localhost"), }; let port: String = match (args.value_of("port"), &book.config.serve.port) { (Some(p), _) => p.to_owned(), - (_, Some(p)) => p.to_owned(), - (_, _) => "3000".to_owned(), + (_, Some(p)) => p.to_string(), + (_, _) => 3000.to_string(), }; let open_browser = args.is_present("open"); diff --git a/src/config.rs b/src/config.rs index 78e38a2d..9cf2a124 100644 --- a/src/config.rs +++ b/src/config.rs @@ -466,7 +466,7 @@ pub struct ServeConfig { /// Default hostname pub hostname: Option, /// Default port - pub port: Option, + pub port: Option, } /// Configuration for the Rust compiler(e.g., for playground)