proxy: Remove try_bind_route! macro (#915)

The macro is now only used once, so it seems clearer just to inline the
logic.
This commit is contained in:
Oliver Gould 2018-05-09 14:38:20 -07:00 committed by GitHub
parent 0431193e94
commit 76ca32297e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 10 deletions

View File

@ -104,15 +104,6 @@ where T: Recognize
}
}
macro_rules! try_bind_route {
( $bind:expr ) => {
match $bind {
Ok(svc) => svc,
Err(e) => return ResponseFuture { state: State::RouteError(e) },
}
}
}
impl<T> Service for Router<T>
where T: Recognize,
{
@ -157,7 +148,11 @@ where T: Recognize,
}
// Bind a new route, send the request on the route, and cache the route.
let mut service = try_bind_route!(inner.recognize.bind_service(&key));
let mut service = match inner.recognize.bind_service(&key) {
Ok(svc) => svc,
Err(e) => return ResponseFuture { state: State::RouteError(e) },
};
let response = service.call(request);
inner.routes.insert(key, service);
ResponseFuture::new(response)