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

View File

@@ -593,7 +593,7 @@ mod functional_test {
cfg_if! { cfg_if! {
if #[cfg(feature = "tls")] { if #[cfg(feature = "tls")] {
const DOMAIN: &'static str = "foobar.com"; const DOMAIN: &str = "foobar.com";
use tls::client::Context; use tls::client::Context;
use native_tls::{Pkcs12, TlsAcceptor, TlsConnector}; 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> { impl<Req, Resp, E> fmt::Debug for Client<Req, Resp, E> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
const PROXY: &'static &str = &"ClientProxy { .. }"; const PROXY: &str = "ClientProxy { .. }";
f.debug_struct("Client").field("proxy", PROXY).finish() f.debug_struct("Client").field("proxy", &PROXY).finish()
} }
} }
@@ -93,11 +93,11 @@ impl Options {
impl fmt::Debug for Options { impl fmt::Debug for Options {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
const SOME: &'static &str = &"Some(_)"; const SOME: &str = "Some(_)";
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
const NONE: &'static &str = &"None"; const NONE: &str = "None";
let mut f = f.debug_struct("Options"); 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() f.finish()
} }
} }

View File

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

View File

@@ -39,10 +39,10 @@ pub mod client {
impl fmt::Debug for Context { impl fmt::Debug for Context {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { 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") f.debug_struct("Context")
.field("domain", &self.domain) .field("domain", &self.domain)
.field("tls_connector", TLS_CONNECTOR) .field("tls_connector", &TLS_CONNECTOR)
.finish() .finish()
} }
} }