aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBilly Bradley <billy@squeno.com>2021-10-18 14:00:15 +0000
committerBilly Bradley <billy@squeno.com>2021-10-18 14:01:18 +0000
commit26e89415f34cc17d8621b21e5802738eefcb3535 (patch)
treef9df905e272185d1c5e92e85e13569551861bca7
parentOnly clone spa_index when necessary (diff)
downloadminiserve-26e89415f34cc17d8621b21e5802738eefcb3535.tar.gz
miniserve-26e89415f34cc17d8621b21e5802738eefcb3535.zip
Use Path instead of PathBuf for parameter
Diffstat (limited to '')
-rw-r--r--src/main.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 32fcdec..eb159a2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,7 @@
use std::io;
use std::io::Write;
use std::net::{IpAddr, SocketAddr, TcpListener};
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::thread;
use std::time::Duration;
@@ -275,9 +275,10 @@ async fn run(miniserve_config: MiniserveConfig) -> Result<(), ContextualError> {
.map_err(|e| ContextualError::IoError("".to_owned(), e))
}
-fn check_file_exists(canon_path: &PathBuf, file_option: &Option<PathBuf>, option_name: &str) {
+fn check_file_exists(canon_path: &Path, file_option: &Option<PathBuf>, option_name: &str) {
if let Some(file_path) = file_option {
- let has_file: std::path::PathBuf = [&canon_path, file_path].iter().collect();
+ let file_path: &Path = file_path.as_ref();
+ let has_file: std::path::PathBuf = [canon_path, file_path].iter().collect();
if !has_file.exists() {
error!(
"The file '{}' provided for option --{} could not be found.",