chore: Update to 2021 edition (#1188)

This commit is contained in:
tottoto
2022-12-13 15:16:49 -05:00
committed by GitHub
parent 25ea473abd
commit bf22a740c3
37 changed files with 29 additions and 52 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ description = """
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
"""
documentation = "https://docs.rs/tonic/0.8.2/tonic/"
edition = "2018"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "futures", "protobuf"]
license = "MIT"
@@ -22,7 +22,7 @@ pub mod client {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
-6
View File
@@ -7,7 +7,6 @@ use super::key::MetadataKey;
use bytes::Bytes;
use http::header::HeaderValue;
use std::convert::TryFrom;
use std::error::Error;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
@@ -286,7 +285,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]);
/// ```
@@ -295,7 +293,6 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err());
/// ```
@@ -324,7 +321,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"hello\xfa").unwrap();
/// assert_eq!(val, &b"hello\xfa"[..]);
/// ```
@@ -333,7 +329,6 @@ impl<'a, VE: ValueEncoding> TryFrom<&'a [u8]> for MetadataValue<VE> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::try_from(b"\n");
/// assert!(val.is_err());
/// ```
@@ -473,7 +468,6 @@ impl MetadataValue<Ascii> {
///
/// ```
/// # use tonic::metadata::*;
/// # use std::convert::TryFrom;
/// let val = AsciiMetadataValue::from_key::<Ascii>("accept".parse().unwrap());
/// assert_eq!(val, AsciiMetadataValue::try_from(b"accept").unwrap());
/// ```
+1 -8
View File
@@ -7,14 +7,7 @@ use crate::transport::service::TlsConnector;
use crate::transport::{service::SharedExec, Error, Executor};
use bytes::Bytes;
use http::{uri::Uri, HeaderValue};
use std::{
convert::{TryFrom, TryInto},
fmt,
future::Future,
pin::Pin,
str::FromStr,
time::Duration,
};
use std::{fmt, future::Future, pin::Pin, str::FromStr, time::Duration};
use tower::make::MakeConnection;
// use crate::transport::E
-2
View File
@@ -3,8 +3,6 @@ use super::io::BoxedIo;
#[cfg(feature = "tls")]
use super::tls::TlsConnector;
use http::Uri;
#[cfg(feature = "tls-roots-common")]
use std::convert::TryInto;
use std::fmt;
use std::task::{Context, Poll};
use tower::make::MakeConnection;
-2
View File
@@ -5,8 +5,6 @@ use crate::transport::{
};
#[cfg(feature = "tls-roots")]
use rustls_native_certs;
#[cfg(feature = "tls")]
use std::convert::TryInto;
use std::{fmt, sync::Arc};
use tokio::io::{AsyncRead, AsyncWrite};
#[cfg(feature = "tls")]