From a95349de02343a89ba9b485861f57c17d39490e9 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 4 Jul 2020 15:46:15 +0200 Subject: Server::start: Return a `Server` directly instead of a `Result` We don't have any `Result`s to propagate in this function, so the `Result` return wrapper is unnecessary. Must have copied this signature from Civet without thinking: https://github.com/conduit-rust/rust-civet/blob/ab9c52ca634f65439060c2248295d2ac354aead5/src/lib.rs#L214 --- src/lib.rs | 2 +- src/server.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index caf8663..4c253b5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ //! //! //! fn main() { -//! Server::start(handler).unwrap(); +//! Server::start(handler); //! } //! //! fn handler(_req: &mut dyn RequestExt) -> std::io::Result> { diff --git a/src/server.rs b/src/server.rs index 95f8325..548d1a4 100644 --- a/src/server.rs +++ b/src/server.rs @@ -45,7 +45,7 @@ impl Server { /// requests and handle them using `handler`. /// /// [fastcgi::run]: ../../fastcgi/fn.run.html - pub fn start(handler: H) -> io::Result { + pub fn start(handler: H) -> Server { fastcgi::run(move |mut raw_request| { match handle_request(&mut raw_request, &handler) { Ok(_) => (), @@ -68,7 +68,7 @@ impl Server { } }); - Ok(Server{}) + Server{} } } -- cgit v1.2.3