diff options
author | Till Hoeppner | 2014-11-30 17:44:11 +0100 |
---|---|---|
committer | Till Hoeppner | 2014-11-30 17:44:11 +0100 |
commit | c19e787b018e4a95924972e5c7d63380abba4237 (patch) | |
tree | 04dd34a1d39ca6ca6d248b8e55a2c7be2de7753f /src/sersve.rs | |
parent | 199583a99b1eb5667033b0b082f07220d3c34ef4 (diff) | |
download | sersve-c19e787b018e4a95924972e5c7d63380abba4237.tar.gz sersve-c19e787b018e4a95924972e5c7d63380abba4237.tar.xz sersve-c19e787b018e4a95924972e5c7d63380abba4237.zip |
Fixed configuration overriding
Diffstat (limited to 'src/sersve.rs')
-rw-r--r-- | src/sersve.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sersve.rs b/src/sersve.rs index 3973632..ebc4636 100644 --- a/src/sersve.rs +++ b/src/sersve.rs @@ -113,7 +113,7 @@ fn render(template: Template, root: Path, dir: Path, files: Vec<Path>, filter: O vec = vec.push_map(|map| item(map, &relative, stat.size, filename.clone())); } } - vec + unsafe { std::mem::transmute(vec) } }).build(); let mut out = Vec::new(); // with_capacity(template.len()) @@ -254,12 +254,12 @@ fn main() { }); let (host, port) = { - options.host = options.host.clone().or(matches.opt_str("a")); - options.port = options.port.or(matches.opt_str("p").and_then(|p| str::from_str(p[]))); - options.root = options.root.clone().or(matches.opt_str("r").and_then(|p| Path::new_opt(p))); - options.filter = options.filter.clone().or(matches.opt_str("f")); - options.max_size = options.max_size.or(matches.opt_str("s").and_then(|s| str::from_str(s[]))); - options.template = options.template.clone().or(matches.opt_str("t")); + options.host = matches.opt_str("a").or(options.host); + options.port = matches.opt_str("p").and_then(|p| str::from_str(p[])).or(options.port); + options.root = matches.opt_str("r").and_then(|p| Path::new_opt(p)).or(options.root); + options.filter = matches.opt_str("f").or(options.filter); + options.max_size = matches.opt_str("s").and_then(|s| str::from_str(s[])).or(options.max_size); + options.template = matches.opt_str("t").or(options.template); (options.host.clone().unwrap_or("0.0.0.0".into_string()), options.port.clone().unwrap_or(8080)) }; |