Fix a warning about unused variables

This commit is contained in:
Emi Tatsuo 2020-12-15 10:32:31 -05:00
parent e49b71b6d2
commit f40f8337f3
Signed by: Emi
GPG key ID: 68FAB2E2E6DFC98B

View file

@ -265,6 +265,7 @@ struct ServerInner {
routes: RoutingNode<Handler>,
timeout: Duration,
complex_timeout: Option<Duration>,
#[cfg(feature = "scgi_srv")]
autorewrite: bool,
#[cfg(feature="ratelimiting")]
rate_limits: RoutingNode<RateLimiter<IpAddr>>,
@ -674,6 +675,7 @@ pub struct Server {
timeout: Duration,
complex_body_timeout_override: Option<Duration>,
routes: RoutingNode<Handler>,
#[cfg(feature = "scgi_srv")]
autorewrite: bool,
#[cfg(feature = "gemini_srv")]
cert_path: PathBuf,
@ -696,6 +698,7 @@ impl Server {
timeout: Duration::from_secs(1),
complex_body_timeout_override: Some(Duration::from_secs(30)),
routes: RoutingNode::default(),
#[cfg(feature = "scgi_srv")]
autorewrite: false,
#[cfg(feature = "gemini_srv")]
cert_path: PathBuf::from("cert/cert.pem"),
@ -881,6 +884,7 @@ impl Server {
self
}
#[cfg_attr(feature = "gemini_srv", allow(unused_mut), allow(unused_variables))]
/// Enable or disable autorewrite
///
/// Many times, an app will served alongside other apps all on one domain. For
@ -943,7 +947,9 @@ impl Server {
/// For more information about what responses are rewritten,
/// see [`Response::rewrite_all()`].
pub fn set_autorewrite(mut self, autorewrite: bool) -> Self {
self.autorewrite = autorewrite;
#[cfg(feature = "scgi_srv")] {
self.autorewrite = autorewrite;
}
self
}
@ -965,6 +971,7 @@ impl Server {
routes: self.routes,
timeout: self.timeout,
complex_timeout: self.complex_body_timeout_override,
#[cfg(feature = "scgi_srv")]
autorewrite: self.autorewrite,
#[cfg(feature = "gemini_srv")]
tls_acceptor: TlsAcceptor::from(config),