Drop more 'static lifetime

This commit is contained in:
Cyril Plisko
2017-12-05 07:11:38 -05:00
parent 77cfffaaed
commit fd47a6c038
5 changed files with 18 additions and 20 deletions

View File

@@ -127,12 +127,12 @@ impl fmt::Debug for Acceptor {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
use self::Acceptor::*;
#[cfg(feature = "tls")]
const TLS: &'static &str = &"TlsAcceptor { .. }";
const TLS: &str = "TlsAcceptor { .. }";
match *self {
Tcp => fmt.debug_tuple("Acceptor::Tcp").finish(),
#[cfg(feature = "tls")]
Tls(_) => fmt.debug_tuple("Acceptlr::Tls").field(TLS).finish(),
Tls(_) => fmt.debug_tuple("Acceptor::Tls").field(&TLS).finish(),
}
}
}
@@ -223,18 +223,18 @@ impl Options {
impl fmt::Debug for Options {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
#[cfg(feature = "tls")]
const SOME: &'static &str = &"Some(_)";
const SOME: &str = "Some(_)";
#[cfg(feature = "tls")]
const NONE: &'static &str = &"None";
const NONE: &str = "None";
let mut debug_struct = fmt.debug_struct("Options");
#[cfg(feature = "tls")]
debug_struct.field(
"tls_acceptor",
if self.tls_acceptor.is_some() {
SOME
&SOME
} else {
NONE
&NONE
},
);
debug_struct.finish()
@@ -352,9 +352,8 @@ where
St: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const HANDLE: &'static &str = &"Handle { .. }";
f.debug_struct("BindStream")
.field("handle", HANDLE)
.field("handle", &self.handle)
.field("new_service", &self.new_service)
.field("stream", &self.stream)
.finish()

View File

@@ -593,7 +593,7 @@ mod functional_test {
cfg_if! {
if #[cfg(feature = "tls")] {
const DOMAIN: &'static str = "foobar.com";
const DOMAIN: &str = "foobar.com";
use tls::client::Context;
use native_tls::{Pkcs12, TlsAcceptor, TlsConnector};

View File

@@ -30,8 +30,8 @@ impl<Req, Resp, E> Clone for Client<Req, Resp, E> {
impl<Req, Resp, E> fmt::Debug for Client<Req, Resp, E> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const PROXY: &'static &str = &"ClientProxy { .. }";
f.debug_struct("Client").field("proxy", PROXY).finish()
const PROXY: &str = "ClientProxy { .. }";
f.debug_struct("Client").field("proxy", &PROXY).finish()
}
}
@@ -93,11 +93,11 @@ impl Options {
impl fmt::Debug for Options {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
#[cfg(feature = "tls")]
const SOME: &'static &str = &"Some(_)";
const SOME: &str = "Some(_)";
#[cfg(feature = "tls")]
const NONE: &'static &str = &"None";
const NONE: &str = "None";
let mut f = f.debug_struct("Options");
#[cfg(feature = "tls")] f.field("tls_ctx", if self.tls_ctx.is_some() { SOME } else { NONE });
#[cfg(feature = "tls")] f.field("tls_ctx", if self.tls_ctx.is_some() { &SOME } else { &NONE });
f.finish()
}
}

View File

@@ -89,13 +89,12 @@ impl Handle {
impl fmt::Debug for Handle {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const CORE: &'static &str = &"Core { .. }";
const SERVER: &'static &str = &"Box<Future<Item = (), Error = ()>>";
const SERVER: &str = "Box<Future<Item = (), Error = ()>>";
f.debug_struct("Handle")
.field("reactor", CORE)
.field("reactor", &self.reactor)
.field("handle", &self.handle)
.field("server", SERVER)
.field("server", &SERVER)
.finish()
}
}

View File

@@ -39,10 +39,10 @@ pub mod client {
impl fmt::Debug for Context {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const TLS_CONNECTOR: &'static &'static str = &"TlsConnector { .. }";
const TLS_CONNECTOR: &str = "TlsConnector { .. }";
f.debug_struct("Context")
.field("domain", &self.domain)
.field("tls_connector", TLS_CONNECTOR)
.field("tls_connector", &TLS_CONNECTOR)
.finish()
}
}