1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-25 02:51:15 +00:00

chore: move deny lints to manifests

This commit is contained in:
Rob Ede 2024-07-07 03:54:00 +01:00
parent b01fbddba4
commit e0e4d1e661
No known key found for this signature in database
GPG key ID: 97C636207D3EF933
42 changed files with 95 additions and 71 deletions

View file

@ -51,3 +51,11 @@ awc = { path = "awc" }
# actix-utils = { path = "../actix-net/actix-utils" } # actix-utils = { path = "../actix-net/actix-utils" }
# actix-tls = { path = "../actix-net/actix-tls" } # actix-tls = { path = "../actix-net/actix-tls" }
# actix-server = { path = "../actix-net/actix-server" } # actix-server = { path = "../actix-net/actix-server" }
[workspace.lints.rust]
rust_2018_idioms = { level = "deny" }
future_incompatible = { level = "deny" }
nonstandard_style = { level = "deny" }
[workspace.lints.clippy]
# clone_on_ref_ptr = { level = "deny" }

View file

@ -54,3 +54,6 @@ actix-test = "0.1"
actix-web = "4" actix-web = "4"
env_logger = "0.11" env_logger = "0.11"
tempfile = "3.2" tempfile = "3.2"
[lints]
workspace = true

View file

@ -11,8 +11,7 @@
//! .service(Files::new("/static", ".").prefer_utf8(true)); //! .service(Files::new("/static", ".").prefer_utf8(true));
//! ``` //! ```
#![deny(rust_2018_idioms, nonstandard_style)] #![warn(missing_docs, missing_debug_implementations)]
#![warn(future_incompatible, missing_docs, missing_debug_implementations)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -59,3 +59,6 @@ tokio = { version = "1.24.2", features = ["sync"] }
[dev-dependencies] [dev-dependencies]
actix-http = "3" actix-http = "3"
[lints]
workspace = true

View file

@ -1,7 +1,5 @@
//! Various helpers for Actix applications to use during testing. //! Various helpers for Actix applications to use during testing.
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -167,6 +167,9 @@ tls-openssl = { package = "openssl", version = "0.10.55" }
tls-rustls_023 = { package = "rustls", version = "0.23" } tls-rustls_023 = { package = "rustls", version = "0.23" }
tokio = { version = "1.24.2", features = ["net", "rt", "macros"] } tokio = { version = "1.24.2", features = ["net", "rt", "macros"] }
[lints]
workspace = true
[[example]] [[example]]
name = "ws" name = "ws"
required-features = ["ws", "rustls-0_23"] required-features = ["ws", "rustls-0_23"]

View file

@ -541,6 +541,6 @@ where
fn call(&self, (io, addr): (T, Option<net::SocketAddr>)) -> Self::Future { fn call(&self, (io, addr): (T, Option<net::SocketAddr>)) -> Self::Future {
let conn_data = OnConnectData::from_io(&io, self.on_connect_ext.as_deref()); let conn_data = OnConnectData::from_io(&io, self.on_connect_ext.as_deref());
Dispatcher::new(io, self.flow.clone(), self.cfg.clone(), addr, conn_data) Dispatcher::new(io, Rc::clone(&self.flow), self.cfg.clone(), addr, conn_data)
} }
} }

View file

@ -434,7 +434,7 @@ where
H2ServiceHandlerResponse { H2ServiceHandlerResponse {
state: State::Handshake( state: State::Handshake(
Some(self.flow.clone()), Some(Rc::clone(&self.flow)),
Some(self.cfg.clone()), Some(self.cfg.clone()),
addr, addr,
on_connect_data, on_connect_data,

View file

@ -20,8 +20,6 @@
//! [rustls]: https://crates.io/crates/rustls //! [rustls]: https://crates.io/crates/rustls
//! [trust-dns]: https://crates.io/crates/trust-dns //! [trust-dns]: https://crates.io/crates/trust-dns
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow( #![allow(
clippy::type_complexity, clippy::type_complexity,
clippy::too_many_arguments, clippy::too_many_arguments,

View file

@ -66,7 +66,7 @@ impl<T: Head> ops::DerefMut for Message<T> {
impl<T: Head> Drop for Message<T> { impl<T: Head> Drop for Message<T> {
fn drop(&mut self) { fn drop(&mut self) {
T::with_pool(|p| p.release(self.head.clone())) T::with_pool(|p| p.release(Rc::clone(&self.head)))
} }
} }

View file

@ -910,7 +910,7 @@ where
handshake: Some(( handshake: Some((
crate::h2::handshake_with_timeout(io, &self.cfg), crate::h2::handshake_with_timeout(io, &self.cfg),
self.cfg.clone(), self.cfg.clone(),
self.flow.clone(), Rc::clone(&self.flow),
conn_data, conn_data,
peer_addr, peer_addr,
)), )),
@ -926,7 +926,7 @@ where
state: State::H1 { state: State::H1 {
dispatcher: h1::Dispatcher::new( dispatcher: h1::Dispatcher::new(
io, io,
self.flow.clone(), Rc::clone(&self.flow),
self.cfg.clone(), self.cfg.clone(),
peer_addr, peer_addr,
conn_data, conn_data,

View file

@ -159,8 +159,8 @@ impl TestBuffer {
#[allow(dead_code)] #[allow(dead_code)]
pub(crate) fn clone(&self) -> Self { pub(crate) fn clone(&self) -> Self {
Self { Self {
read_buf: self.read_buf.clone(), read_buf: Rc::clone(&self.read_buf),
write_buf: self.write_buf.clone(), write_buf: Rc::clone(&self.write_buf),
err: self.err.clone(), err: self.err.clone(),
} }
} }

View file

@ -29,3 +29,6 @@ actix-multipart = "0.7"
actix-web = "4" actix-web = "4"
rustversion = "1" rustversion = "1"
trybuild = "1" trybuild = "1"
[lints]
workspace = true

View file

@ -2,8 +2,6 @@
//! //!
//! See [`macro@MultipartForm`] for usage examples. //! See [`macro@MultipartForm`] for usage examples.
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -71,7 +71,5 @@ multer = "3"
tokio = { version = "1.24.2", features = ["sync"] } tokio = { version = "1.24.2", features = ["sync"] }
tokio-stream = "0.1" tokio-stream = "0.1"
[lints.rust] [lints]
future_incompatible = { level = "deny" } workspace = true
rust_2018_idioms = { level = "deny" }
nonstandard_style = { level = "deny" }

View file

@ -38,6 +38,9 @@ http = "0.2.7"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
percent-encoding = "2.1" percent-encoding = "2.1"
[lints]
workspace = true
[[bench]] [[bench]]
name = "router" name = "router"
harness = false harness = false

View file

@ -1,7 +1,5 @@
//! Resource path matching and router. //! Resource path matching and router.
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -73,3 +73,6 @@ tls-rustls-0_21 = { package = "rustls", version = "0.21", optional = true }
tls-rustls-0_22 = { package = "rustls", version = "0.22", optional = true } tls-rustls-0_22 = { package = "rustls", version = "0.22", optional = true }
tls-rustls-0_23 = { package = "rustls", version = "0.23", default-features = false, optional = true } tls-rustls-0_23 = { package = "rustls", version = "0.23", default-features = false, optional = true }
tokio = { version = "1.24.2", features = ["sync"] } tokio = { version = "1.24.2", features = ["sync"] }
[lints]
workspace = true

View file

@ -27,8 +27,6 @@
//! } //! }
//! ``` //! ```
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -41,3 +41,6 @@ actix-web = { version = "4", features = ["macros"] }
env_logger = "0.11" env_logger = "0.11"
futures-util = { version = "0.3.17", default-features = false, features = ["std"] } futures-util = { version = "0.3.17", default-features = false, features = ["std"] }
mime = "0.3" mime = "0.3"
[lints]
workspace = true

View file

@ -55,8 +55,6 @@
//! * [`HttpContext`]: This struct provides actor support for streaming HTTP responses. //! * [`HttpContext`]: This struct provides actor support for streaming HTTP responses.
//! //!
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -35,3 +35,6 @@ actix-web = "4"
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] } futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
trybuild = "1" trybuild = "1"
rustversion = "1" rustversion = "1"
[lints]
workspace = true

View file

@ -73,8 +73,6 @@
//! [DELETE]: macro@delete //! [DELETE]: macro@delete
#![recursion_limit = "512"] #![recursion_limit = "512"]
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -145,7 +145,7 @@ async fn custom_resource_name_test<'a>(req: HttpRequest) -> impl Responder {
mod guard_module { mod guard_module {
use actix_web::{guard::GuardContext, http::header}; use actix_web::{guard::GuardContext, http::header};
pub fn guard(ctx: &GuardContext) -> bool { pub fn guard(ctx: &GuardContext<'_>) -> bool {
ctx.header::<header::Accept>() ctx.header::<header::Accept>()
.map(|h| h.preference() == "image/*") .map(|h| h.preference() == "image/*")
.unwrap_or(false) .unwrap_or(false)

View file

@ -1,7 +1,7 @@
use actix_web::{guard::GuardContext, http, http::header, web, App, HttpResponse, Responder}; use actix_web::{guard::GuardContext, http, http::header, web, App, HttpResponse, Responder};
use actix_web_codegen::{delete, get, post, route, routes, scope}; use actix_web_codegen::{delete, get, post, route, routes, scope};
pub fn image_guard(ctx: &GuardContext) -> bool { pub fn image_guard(ctx: &GuardContext<'_>) -> bool {
ctx.header::<header::Accept>() ctx.header::<header::Accept>()
.map(|h| h.preference() == "image/*") .map(|h| h.preference() == "image/*")
.unwrap_or(false) .unwrap_or(false)

View file

@ -188,6 +188,9 @@ tls-rustls = { package = "rustls", version = "0.23" }
tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] } tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] }
zstd = "0.13" zstd = "0.13"
[lints]
workspace = true
[[test]] [[test]]
name = "test_server" name = "test_server"
required-features = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"] required-features = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]

View file

@ -39,7 +39,7 @@ impl App<AppEntry> {
let factory_ref = Rc::new(RefCell::new(None)); let factory_ref = Rc::new(RefCell::new(None));
App { App {
endpoint: AppEntry::new(factory_ref.clone()), endpoint: AppEntry::new(Rc::clone(&factory_ref)),
data_factories: Vec::new(), data_factories: Vec::new(),
services: Vec::new(), services: Vec::new(),
default: None, default: None,

View file

@ -71,7 +71,7 @@ where
}); });
// create App config to pass to child services // create App config to pass to child services
let mut config = AppService::new(config, default.clone()); let mut config = AppService::new(config, Rc::clone(&default));
// register services // register services
mem::take(&mut *self.services.borrow_mut()) mem::take(&mut *self.services.borrow_mut())

View file

@ -68,7 +68,7 @@ impl AppService {
pub(crate) fn clone_config(&self) -> Self { pub(crate) fn clone_config(&self) -> Self {
AppService { AppService {
config: self.config.clone(), config: self.config.clone(),
default: self.default.clone(), default: Rc::clone(&self.default),
services: Vec::new(), services: Vec::new(),
root: false, root: false,
} }
@ -81,7 +81,7 @@ impl AppService {
/// Returns default handler factory. /// Returns default handler factory.
pub fn default_service(&self) -> Rc<BoxedHttpServiceFactory> { pub fn default_service(&self) -> Rc<BoxedHttpServiceFactory> {
self.default.clone() Rc::clone(&self.default)
} }
/// Register HTTP service. /// Register HTTP service.

View file

@ -184,7 +184,7 @@ impl<T: ?Sized + 'static> FromRequest for Data<T> {
impl<T: ?Sized + 'static> DataFactory for Data<T> { impl<T: ?Sized + 'static> DataFactory for Data<T> {
fn create(&self, extensions: &mut Extensions) -> bool { fn create(&self, extensions: &mut Extensions) -> bool {
extensions.insert(Data(self.0.clone())); extensions.insert(Data(Arc::clone(&self.0)));
true true
} }
} }

View file

@ -70,8 +70,6 @@
//! - `rustls-0_23` - HTTPS support via `rustls` 0.23 crate, supports `HTTP/2` //! - `rustls-0_23` - HTTPS support via `rustls` 0.23 crate, supports `HTTP/2`
//! - `secure-cookies` - secure cookies support //! - `secure-cookies` - secure cookies support
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]

View file

@ -141,7 +141,7 @@ where
actix_service::forward_ready!(service); actix_service::forward_ready!(service);
fn call(&self, req: ServiceRequest) -> Self::Future { fn call(&self, req: ServiceRequest) -> Self::Future {
let inner = self.inner.clone(); let inner = Rc::clone(&self.inner);
let fut = self.service.call(req); let fut = self.service.call(req);
DefaultHeaderFuture { DefaultHeaderFuture {

View file

@ -220,16 +220,20 @@ impl<B> ErrorHandlers<B> {
/// [`.handler()`][ErrorHandlers::handler]) will fall back on this. /// [`.handler()`][ErrorHandlers::handler]) will fall back on this.
/// ///
/// Note that this will overwrite any default handlers previously set by calling /// Note that this will overwrite any default handlers previously set by calling
/// [`.default_handler_client()`][ErrorHandlers::default_handler_client] or /// [`default_handler_client()`] or [`.default_handler_server()`], but not any set by calling
/// [`.default_handler_server()`][ErrorHandlers::default_handler_server], but not any set by /// [`.handler()`].
/// calling [`.handler()`][ErrorHandlers::handler]. ///
/// [`default_handler_client()`]: ErrorHandlers::default_handler_client
/// [`.default_handler_server()`]: ErrorHandlers::default_handler_server
/// [`.handler()`]: ErrorHandlers::handler
pub fn default_handler<F>(self, handler: F) -> Self pub fn default_handler<F>(self, handler: F) -> Self
where where
F: Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> + 'static, F: Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> + 'static,
{ {
let handler = Rc::new(handler); let handler = Rc::new(handler);
let handler2 = Rc::clone(&handler);
Self { Self {
default_server: Some(handler.clone()), default_server: Some(handler2),
default_client: Some(handler), default_client: Some(handler),
..self ..self
} }
@ -288,7 +292,7 @@ where
type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>; type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>;
fn new_transform(&self, service: S) -> Self::Future { fn new_transform(&self, service: S) -> Self::Future {
let handlers = self.handlers.clone(); let handlers = Rc::clone(&self.handlers);
let default_client = self.default_client.clone(); let default_client = self.default_client.clone();
let default_server = self.default_server.clone(); let default_server = self.default_server.clone();
Box::pin(async move { Box::pin(async move {
@ -323,7 +327,7 @@ where
actix_service::forward_ready!(service); actix_service::forward_ready!(service);
fn call(&self, req: ServiceRequest) -> Self::Future { fn call(&self, req: ServiceRequest) -> Self::Future {
let handlers = self.handlers.clone(); let handlers = Rc::clone(&self.handlers);
let default_client = self.default_client.clone(); let default_client = self.default_client.clone();
let default_server = self.default_server.clone(); let default_server = self.default_server.clone();
let fut = self.service.call(req); let fut = self.service.call(req);

View file

@ -276,7 +276,7 @@ where
ready(Ok(LoggerMiddleware { ready(Ok(LoggerMiddleware {
service, service,
inner: self.0.clone(), inner: Rc::clone(&self.0),
})) }))
} }
} }

View file

@ -62,14 +62,14 @@ pub struct Resource<T = ResourceEndpoint> {
impl Resource { impl Resource {
/// Constructs new resource that matches a `path` pattern. /// Constructs new resource that matches a `path` pattern.
pub fn new<T: IntoPatterns>(path: T) -> Resource { pub fn new<T: IntoPatterns>(path: T) -> Resource {
let fref = Rc::new(RefCell::new(None)); let factory_ref = Rc::new(RefCell::new(None));
Resource { Resource {
routes: Vec::new(), routes: Vec::new(),
rdef: path.patterns(), rdef: path.patterns(),
name: None, name: None,
endpoint: ResourceEndpoint::new(fref.clone()), endpoint: ResourceEndpoint::new(Rc::clone(&factory_ref)),
factory_ref: fref, factory_ref,
guards: Vec::new(), guards: Vec::new(),
app_data: None, app_data: None,
default: boxed::factory(fn_service(|req: ServiceRequest| async { default: boxed::factory(fn_service(|req: ServiceRequest| async {

View file

@ -77,7 +77,7 @@ impl ServiceFactory<ServiceRequest> for Route {
fn new_service(&self, _: ()) -> Self::Future { fn new_service(&self, _: ()) -> Self::Future {
let fut = self.service.new_service(()); let fut = self.service.new_service(());
let guards = self.guards.clone(); let guards = Rc::clone(&self.guards);
Box::pin(async move { Box::pin(async move {
let service = fut.await?; let service = fut.await?;

View file

@ -510,7 +510,7 @@ where
/// No changes are made to `lst`'s configuration. Ensure it is configured properly before /// No changes are made to `lst`'s configuration. Ensure it is configured properly before
/// passing ownership to `listen()`. /// passing ownership to `listen()`.
pub fn listen(mut self, lst: net::TcpListener) -> io::Result<Self> { pub fn listen(mut self, lst: net::TcpListener) -> io::Result<Self> {
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let factory = self.factory.clone(); let factory = self.factory.clone();
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
@ -554,7 +554,7 @@ where
/// Binds to existing listener for accepting incoming plaintext HTTP/1.x or HTTP/2 connections. /// Binds to existing listener for accepting incoming plaintext HTTP/1.x or HTTP/2 connections.
#[cfg(feature = "http2")] #[cfg(feature = "http2")]
pub fn listen_auto_h2c(mut self, lst: net::TcpListener) -> io::Result<Self> { pub fn listen_auto_h2c(mut self, lst: net::TcpListener) -> io::Result<Self> {
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let factory = self.factory.clone(); let factory = self.factory.clone();
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
@ -632,7 +632,7 @@ where
config: actix_tls::accept::rustls_0_20::reexports::ServerConfig, config: actix_tls::accept::rustls_0_20::reexports::ServerConfig,
) -> io::Result<Self> { ) -> io::Result<Self> {
let factory = self.factory.clone(); let factory = self.factory.clone();
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
self.sockets.push(Socket { self.sockets.push(Socket {
addr, addr,
@ -683,7 +683,7 @@ where
config: actix_tls::accept::rustls_0_21::reexports::ServerConfig, config: actix_tls::accept::rustls_0_21::reexports::ServerConfig,
) -> io::Result<Self> { ) -> io::Result<Self> {
let factory = self.factory.clone(); let factory = self.factory.clone();
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
self.sockets.push(Socket { self.sockets.push(Socket {
addr, addr,
@ -749,7 +749,7 @@ where
config: actix_tls::accept::rustls_0_22::reexports::ServerConfig, config: actix_tls::accept::rustls_0_22::reexports::ServerConfig,
) -> io::Result<Self> { ) -> io::Result<Self> {
let factory = self.factory.clone(); let factory = self.factory.clone();
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
self.sockets.push(Socket { self.sockets.push(Socket {
addr, addr,
@ -815,7 +815,7 @@ where
config: actix_tls::accept::rustls_0_23::reexports::ServerConfig, config: actix_tls::accept::rustls_0_23::reexports::ServerConfig,
) -> io::Result<Self> { ) -> io::Result<Self> {
let factory = self.factory.clone(); let factory = self.factory.clone();
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
self.sockets.push(Socket { self.sockets.push(Socket {
addr, addr,
@ -880,7 +880,7 @@ where
acceptor: SslAcceptor, acceptor: SslAcceptor,
) -> io::Result<Self> { ) -> io::Result<Self> {
let factory = self.factory.clone(); let factory = self.factory.clone();
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let addr = lst.local_addr().unwrap(); let addr = lst.local_addr().unwrap();
self.sockets.push(Socket { self.sockets.push(Socket {
addr, addr,
@ -937,7 +937,7 @@ where
use actix_rt::net::UnixStream; use actix_rt::net::UnixStream;
use actix_service::{fn_service, ServiceFactoryExt as _}; use actix_service::{fn_service, ServiceFactoryExt as _};
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let factory = self.factory.clone(); let factory = self.factory.clone();
let socket_addr = let socket_addr =
net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080); net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080);
@ -982,7 +982,7 @@ where
use actix_rt::net::UnixStream; use actix_rt::net::UnixStream;
use actix_service::{fn_service, ServiceFactoryExt as _}; use actix_service::{fn_service, ServiceFactoryExt as _};
let cfg = self.config.clone(); let cfg = Arc::clone(&self.config);
let factory = self.factory.clone(); let factory = self.factory.clone();
let socket_addr = let socket_addr =
net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080); net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080);

View file

@ -153,6 +153,9 @@ tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] }
zstd = "0.13" zstd = "0.13"
tls-rustls-0_23 = { package = "rustls", version = "0.23" } # add rustls 0.23 with default features to make aws_lc_rs work in tests tls-rustls-0_23 = { package = "rustls", version = "0.23" } # add rustls 0.23 with default features to make aws_lc_rs work in tests
[lints]
workspace = true
[[example]] [[example]]
name = "client" name = "client"
required-features = ["rustls-0_23-webpki-roots"] required-features = ["rustls-0_23-webpki-roots"]

View file

@ -173,12 +173,15 @@ where
}; };
// acquire an owned permit and carry it with connection // acquire an owned permit and carry it with connection
let permit = inner.permits.clone().acquire_owned().await.map_err(|_| { let permit = Arc::clone(&inner.permits)
ConnectError::Io(io::Error::new( .acquire_owned()
io::ErrorKind::Other, .await
"failed to acquire semaphore on client connection pool", .map_err(|_| {
)) ConnectError::Io(io::Error::new(
})?; io::ErrorKind::Other,
"failed to acquire semaphore on client connection pool",
))
})?;
let conn = { let conn = {
let mut conn = None; let mut conn = None;

View file

@ -49,7 +49,7 @@ impl FrozenClientRequest {
where where
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
RequestSender::Rc(self.head.clone(), None).send_body( RequestSender::Rc(Rc::clone(&self.head), None).send_body(
self.addr, self.addr,
self.response_decompress, self.response_decompress,
self.timeout, self.timeout,
@ -60,7 +60,7 @@ impl FrozenClientRequest {
/// Send a json body. /// Send a json body.
pub fn send_json<T: Serialize>(&self, value: &T) -> SendClientRequest { pub fn send_json<T: Serialize>(&self, value: &T) -> SendClientRequest {
RequestSender::Rc(self.head.clone(), None).send_json( RequestSender::Rc(Rc::clone(&self.head), None).send_json(
self.addr, self.addr,
self.response_decompress, self.response_decompress,
self.timeout, self.timeout,
@ -71,7 +71,7 @@ impl FrozenClientRequest {
/// Send an urlencoded body. /// Send an urlencoded body.
pub fn send_form<T: Serialize>(&self, value: &T) -> SendClientRequest { pub fn send_form<T: Serialize>(&self, value: &T) -> SendClientRequest {
RequestSender::Rc(self.head.clone(), None).send_form( RequestSender::Rc(Rc::clone(&self.head), None).send_form(
self.addr, self.addr,
self.response_decompress, self.response_decompress,
self.timeout, self.timeout,
@ -86,7 +86,7 @@ impl FrozenClientRequest {
S: Stream<Item = Result<Bytes, E>> + 'static, S: Stream<Item = Result<Bytes, E>> + 'static,
E: Into<BoxError> + 'static, E: Into<BoxError> + 'static,
{ {
RequestSender::Rc(self.head.clone(), None).send_stream( RequestSender::Rc(Rc::clone(&self.head), None).send_stream(
self.addr, self.addr,
self.response_decompress, self.response_decompress,
self.timeout, self.timeout,
@ -97,7 +97,7 @@ impl FrozenClientRequest {
/// Send an empty body. /// Send an empty body.
pub fn send(&self) -> SendClientRequest { pub fn send(&self) -> SendClientRequest {
RequestSender::Rc(self.head.clone(), None).send( RequestSender::Rc(Rc::clone(&self.head), None).send(
self.addr, self.addr,
self.response_decompress, self.response_decompress,
self.timeout, self.timeout,

View file

@ -100,8 +100,6 @@
//! # } //! # }
//! ``` //! ```
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(unknown_lints)] // temp: #[allow(non_local_definitions)] #![allow(unknown_lints)] // temp: #[allow(non_local_definitions)]
#![allow( #![allow(
clippy::type_complexity, clippy::type_complexity,

View file

@ -78,7 +78,7 @@ where
RedirectServiceFuture::Tunnel { fut } RedirectServiceFuture::Tunnel { fut }
} }
ConnectRequest::Client(head, body, addr) => { ConnectRequest::Client(head, body, addr) => {
let connector = self.connector.clone(); let connector = Rc::clone(&self.connector);
let max_redirect_times = self.max_redirect_times; let max_redirect_times = self.max_redirect_times;
// backup the uri and method for reuse schema and authority. // backup the uri and method for reuse schema and authority.