Enable rustls/std feature (#494)

This commit is contained in:
Nikolay Kim 2024-12-30 18:40:31 +05:00 committed by GitHub
parent 48702413f3
commit 5fd9d7ce90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 35 additions and 31 deletions

View file

@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
check:
name: Check for build failures
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -12,7 +12,7 @@ jobs:
with:
toolchain: stable
- run:
cargo check --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
cargo check --tests --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
clippy:
name: Clippy
@ -24,7 +24,7 @@ jobs:
toolchain: stable
components: clippy
- run:
cargo test --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
cargo clippy --tests --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli"
fmt:
name: Rustfmt

View file

@ -3779,7 +3779,7 @@ impl<const N: usize> PartialEq<BytesMut> for [u8; N] {
}
}
impl<'a, const N: usize> PartialEq<BytesMut> for &'a [u8; N] {
impl<const N: usize> PartialEq<BytesMut> for &[u8; N] {
fn eq(&self, other: &BytesMut) -> bool {
*other == *self
}
@ -3878,7 +3878,7 @@ impl<const N: usize> PartialEq<Bytes> for [u8; N] {
}
}
impl<'a, const N: usize> PartialEq<Bytes> for &'a [u8; N] {
impl<const N: usize> PartialEq<Bytes> for &[u8; N] {
fn eq(&self, other: &Bytes) -> bool {
*other == *self
}
@ -4076,7 +4076,7 @@ impl<const N: usize> PartialEq<BytesVec> for [u8; N] {
}
}
impl<'a, const N: usize> PartialEq<BytesVec> for &'a [u8; N] {
impl<const N: usize> PartialEq<BytesVec> for &[u8; N] {
fn eq(&self, other: &BytesVec) -> bool {
*other == *self
}

View file

@ -3,7 +3,7 @@ use std::fmt::{Formatter, LowerHex, Result, UpperHex};
struct BytesRef<'a>(&'a [u8]);
impl<'a> LowerHex for BytesRef<'a> {
impl LowerHex for BytesRef<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
for b in self.0 {
write!(f, "{b:02x}")?;
@ -12,7 +12,7 @@ impl<'a> LowerHex for BytesRef<'a> {
}
}
impl<'a> UpperHex for BytesRef<'a> {
impl UpperHex for BytesRef<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
for b in self.0 {
write!(f, "{b:02X}")?;

View file

@ -354,13 +354,13 @@ impl AsName for HeaderName {
}
}
impl<'a> AsName for &'a HeaderName {
impl AsName for &HeaderName {
fn as_name(&self) -> Either<&HeaderName, &str> {
Either::Left(self)
}
}
impl<'a> AsName for &'a str {
impl AsName for &str {
fn as_name(&self) -> Either<&HeaderName, &str> {
Either::Right(self)
}
@ -372,7 +372,7 @@ impl AsName for String {
}
}
impl<'a> AsName for &'a String {
impl AsName for &String {
fn as_name(&self) -> Either<&HeaderName, &str> {
Either::Right(self.as_str())
}

View file

@ -158,7 +158,7 @@ impl<'de> Deserialize<'de> for HeaderValue {
struct HeaderValueVisitor;
impl<'de> Visitor<'de> for HeaderValueVisitor {
impl Visitor<'_> for HeaderValueVisitor {
type Value = HeaderValue;
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {

View file

@ -641,14 +641,14 @@ impl PartialOrd<HeaderValue> for String {
}
}
impl<'a> PartialEq<HeaderValue> for &'a HeaderValue {
impl PartialEq<HeaderValue> for &HeaderValue {
#[inline]
fn eq(&self, other: &HeaderValue) -> bool {
**self == *other
}
}
impl<'a> PartialOrd<HeaderValue> for &'a HeaderValue {
impl PartialOrd<HeaderValue> for &HeaderValue {
#[inline]
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
(**self).partial_cmp(other)
@ -675,14 +675,14 @@ where
}
}
impl<'a> PartialEq<HeaderValue> for &'a str {
impl PartialEq<HeaderValue> for &str {
#[inline]
fn eq(&self, other: &HeaderValue) -> bool {
*other == *self
}
}
impl<'a> PartialOrd<HeaderValue> for &'a str {
impl PartialOrd<HeaderValue> for &str {
#[inline]
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
self.as_bytes().partial_cmp(other.as_bytes())

View file

@ -300,7 +300,7 @@ pub struct ReadBuf<'a> {
pub(crate) need_write: Cell<bool>,
}
impl<'a> ReadBuf<'a> {
impl ReadBuf<'_> {
#[inline]
/// Get io tag
pub fn tag(&self) -> &'static str {
@ -444,7 +444,7 @@ pub struct WriteBuf<'a> {
pub(crate) need_write: Cell<bool>,
}
impl<'a> WriteBuf<'a> {
impl WriteBuf<'_> {
#[inline]
/// Get io tag
pub fn tag(&self) -> &'static str {

View file

@ -87,7 +87,7 @@ impl ReadContext {
// handle incoming data
let total2 = buf.len();
let nbytes = if total2 > total { total2 - total } else { 0 };
let nbytes = total2.saturating_sub(total);
let total = total2;
if let Some(mut first_buf) = inner.buffer.get_read_source() {

View file

@ -42,7 +42,7 @@ impl ResourcePath for String {
}
}
impl<'a> ResourcePath for &'a str {
impl ResourcePath for &str {
fn path(&self) -> &str {
self
}
@ -54,7 +54,7 @@ impl ResourcePath for ntex_bytes::ByteString {
}
}
impl<'a, T: ResourcePath> ResourcePath for &'a T {
impl<T: ResourcePath> ResourcePath for &T {
fn path(&self) -> &str {
(*self).path()
}
@ -71,13 +71,13 @@ impl IntoPattern for String {
}
}
impl<'a> IntoPattern for &'a String {
impl IntoPattern for &String {
fn patterns(&self) -> Vec<String> {
vec![self.as_str().to_string()]
}
}
impl<'a> IntoPattern for &'a str {
impl IntoPattern for &str {
fn patterns(&self) -> Vec<String> {
vec![(*self).to_string()]
}

View file

@ -1,5 +1,9 @@
# Changes
## [2.4.0] - 2024-12-30
* Enable rustls/std feature
## [2.3.0] - 2024-11-04
* Use updated Service trait

View file

@ -1,6 +1,6 @@
[package]
name = "ntex-tls"
version = "2.3.0"
version = "2.4.0"
authors = ["ntex contributors <team@ntex.rs>"]
description = "An implementation of SSL streams for ntex backed by OpenSSL"
keywords = ["network", "framework", "async", "futures"]
@ -22,14 +22,14 @@ default = []
openssl = ["tls_openssl"]
# rustls support
rustls = ["tls_rust"]
rustls = ["tls_rust", "tls_rust/std"]
rustls-ring = ["tls_rust", "tls_rust/ring", "tls_rust/std"]
[dependencies]
ntex-bytes = "0.1"
ntex-io = "2.3"
ntex-util = "2.5"
ntex-service = "3.3"
ntex-service = "3.4"
ntex-net = "2"
log = "0.4"

View file

@ -24,7 +24,7 @@ pub struct PeerCertChain<'a>(pub Vec<CertificateDer<'a>>);
pub(crate) struct Wrapper<'a, 'b>(&'a WriteBuf<'b>);
impl<'a, 'b> io::Read for Wrapper<'a, 'b> {
impl io::Read for Wrapper<'_, '_> {
fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> {
self.0.with_read_buf(|buf| {
buf.with_src(|buf| {
@ -41,7 +41,7 @@ impl<'a, 'b> io::Read for Wrapper<'a, 'b> {
}
}
impl<'a, 'b> io::Write for Wrapper<'a, 'b> {
impl io::Write for Wrapper<'_, '_> {
fn write(&mut self, src: &[u8]) -> io::Result<usize> {
self.0.with_dst(|buf| buf.extend_from_slice(src));
Ok(src.len())

View file

@ -29,7 +29,7 @@ pub trait ResponseError: fmt::Display + fmt::Debug {
}
}
impl<'a, T: ResponseError> ResponseError for &'a T {
impl<T: ResponseError> ResponseError for &T {
fn error_response(&self) -> Response {
(*self).error_response()
}

View file

@ -6,7 +6,7 @@ use crate::util::BytesMut;
pub(crate) struct Writer<'a>(pub(crate) &'a mut BytesMut);
impl<'a> io::Write for Writer<'a> {
impl io::Write for Writer<'_> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.extend_from_slice(buf);
Ok(buf.len())

View file

@ -400,7 +400,7 @@ pub(crate) struct FormatDisplay<'a>(
&'a dyn Fn(&mut fmt::Formatter<'_>) -> Result<(), fmt::Error>,
);
impl<'a> fmt::Display for FormatDisplay<'a> {
impl fmt::Display for FormatDisplay<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
(self.0)(fmt)
}