mirror of
https://github.com/actix/actix-web.git
synced 2024-11-25 02:51:15 +00:00
address clippy lints
For intrepid commit message readers: The choice to add allows for the inlined format args lint instead of actually inlining them is not very clear because our actual real world MSRV is not clear. We currently claim 1.60 is our MSRV but this is mainly due to dependencies. I'm fairly sure that we could support < 1.58 if those deps are outdated in a users lockfile. We'll remove these allows again at some point soon.
This commit is contained in:
parent
06c3513bc0
commit
6f0a6bd1bb
31 changed files with 52 additions and 10 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible, missing_docs, missing_debug_implementations)]
|
#![warn(future_incompatible, missing_docs, missing_debug_implementations)]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use actix_service::boxed::{BoxService, BoxServiceFactory};
|
use actix_service::boxed::{BoxService, BoxServiceFactory};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
#![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")]
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ pub async fn test_server_with_addr<F: ServerServiceFactory<TcpStream>>(
|
||||||
|
|
||||||
// notify TestServer that server and system have shut down
|
// notify TestServer that server and system have shut down
|
||||||
// all thread managed resources should be dropped at this point
|
// all thread managed resources should be dropped at this point
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = thread_stop_tx.send(());
|
let _ = thread_stop_tx.send(());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -294,6 +296,7 @@ impl Drop for TestServer {
|
||||||
// without needing to await anything
|
// without needing to await anything
|
||||||
|
|
||||||
// signal server to stop
|
// signal server to stop
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = self.server.stop(true);
|
let _ = self.server.stop(true);
|
||||||
|
|
||||||
// signal system to stop
|
// signal system to stop
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
||||||
|
|
||||||
const CODES: &[u16] = &[0, 1000, 201, 800, 550];
|
const CODES: &[u16] = &[0, 1000, 201, 800, 550];
|
||||||
|
|
|
@ -44,7 +44,7 @@ where
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn size(&self) -> BodySize {
|
fn size(&self) -> BodySize {
|
||||||
BodySize::Sized(self.size as u64)
|
BodySize::Sized(self.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to pull out the next value of the underlying [`Stream`].
|
/// Attempts to pull out the next value of the underlying [`Stream`].
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl ChunkedState {
|
||||||
|
|
||||||
match size.checked_mul(radix) {
|
match size.checked_mul(radix) {
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
*size = n as u64;
|
*size = n;
|
||||||
*size += rem as u64;
|
*size += rem as u64;
|
||||||
|
|
||||||
Poll::Ready(Ok(ChunkedState::Size))
|
Poll::Ready(Ok(ChunkedState::Size))
|
||||||
|
|
|
@ -450,7 +450,7 @@ impl TransferEncoding {
|
||||||
|
|
||||||
buf.extend_from_slice(&msg[..len as usize]);
|
buf.extend_from_slice(&msg[..len as usize]);
|
||||||
|
|
||||||
*remaining -= len as u64;
|
*remaining -= len;
|
||||||
Ok(*remaining == 0)
|
Ok(*remaining == 0)
|
||||||
} else {
|
} else {
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::type_complexity,
|
clippy::type_complexity,
|
||||||
clippy::too_many_arguments,
|
clippy::too_many_arguments,
|
||||||
clippy::borrow_interior_mutable_const
|
clippy::borrow_interior_mutable_const,
|
||||||
|
clippy::uninlined_format_args
|
||||||
)]
|
)]
|
||||||
#![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")]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![cfg(feature = "openssl")]
|
#![cfg(feature = "openssl")]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
extern crate tls_openssl as openssl;
|
extern crate tls_openssl as openssl;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![cfg(feature = "rustls")]
|
#![cfg(feature = "rustls")]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
extern crate tls_rustls as rustls;
|
extern crate tls_rustls as rustls;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::Cell,
|
cell::Cell,
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
#![allow(clippy::borrow_interior_mutable_const)]
|
#![allow(clippy::borrow_interior_mutable_const, clippy::uninlined_format_args)]
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod extractor;
|
mod extractor;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
#![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")]
|
||||||
|
|
||||||
|
|
|
@ -321,6 +321,7 @@ where
|
||||||
// all thread managed resources should be dropped at this point
|
// all thread managed resources should be dropped at this point
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = thread_stop_tx.send(());
|
let _ = thread_stop_tx.send(());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -567,6 +568,7 @@ impl Drop for TestServer {
|
||||||
// without needing to await anything
|
// without needing to await anything
|
||||||
|
|
||||||
// signal server to stop
|
// signal server to stop
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = self.server.stop(true);
|
let _ = self.server.stop(true);
|
||||||
|
|
||||||
// signal system to stop
|
// signal system to stop
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
mod context;
|
mod context;
|
||||||
pub mod ws;
|
pub mod ws;
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl Args {
|
||||||
if !methods.insert(method) {
|
if !methods.insert(method) {
|
||||||
return Err(syn::Error::new_spanned(
|
return Err(syn::Error::new_spanned(
|
||||||
&nv.lit,
|
&nv.lit,
|
||||||
&format!(
|
format!(
|
||||||
"HTTP method defined more than once: `{}`",
|
"HTTP method defined more than once: `{}`",
|
||||||
lit.value()
|
lit.value()
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use actix_web::{web, App, HttpResponse};
|
use actix_web::{web, App, HttpResponse};
|
||||||
use awc::Client;
|
use awc::Client;
|
||||||
use criterion::{criterion_group, criterion_main, Criterion};
|
use criterion::{criterion_group, criterion_main, Criterion};
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer};
|
use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer};
|
||||||
|
|
||||||
#[get("/resource1/{name}/index.html")]
|
#[get("/resource1/{name}/index.html")]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
|
use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
|
||||||
|
|
||||||
async fn index(req: HttpRequest) -> &'static str {
|
async fn index(req: HttpRequest) -> &'static str {
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
//! For an example of extracting a client TLS certificate, see:
|
//! For an example of extracting a client TLS certificate, see:
|
||||||
//! <https://github.com/actix/examples/tree/master/https-tls/rustls-client-cert>
|
//! <https://github.com/actix/examples/tree/master/https-tls/rustls-client-cert>
|
||||||
|
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use std::{any::Any, io, net::SocketAddr};
|
use std::{any::Any, io, net::SocketAddr};
|
||||||
|
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use actix_web::{get, web, HttpRequest};
|
use actix_web::{get, web, HttpRequest};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use actix_web::{middleware, App, Error, HttpResponse, HttpServer};
|
use actix_web::{middleware, App, Error, HttpResponse, HttpServer};
|
||||||
|
|
|
@ -712,6 +712,7 @@ mod tests {
|
||||||
.route("/", web::to(|| async { "hello" }))
|
.route("/", web::to(|| async { "hello" }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = init_service(my_app());
|
let _ = init_service(my_app());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
|
|
||||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
#![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_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
#[cfg(feature = "openssl")]
|
#[cfg(feature = "openssl")]
|
||||||
extern crate tls_openssl as openssl;
|
extern crate tls_openssl as openssl;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
|
@ -210,7 +210,7 @@ where
|
||||||
};
|
};
|
||||||
self.add_default_header((
|
self.add_default_header((
|
||||||
header::AUTHORIZATION,
|
header::AUTHORIZATION,
|
||||||
format!("Basic {}", base64::encode(&auth)),
|
format!("Basic {}", base64::encode(auth)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,8 @@
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::type_complexity,
|
clippy::type_complexity,
|
||||||
clippy::borrow_interior_mutable_const,
|
clippy::borrow_interior_mutable_const,
|
||||||
clippy::needless_doctest_main
|
clippy::needless_doctest_main,
|
||||||
|
clippy::uninlined_format_args
|
||||||
)]
|
)]
|
||||||
#![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")]
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl ClientRequest {
|
||||||
|
|
||||||
self.insert_header((
|
self.insert_header((
|
||||||
header::AUTHORIZATION,
|
header::AUTHORIZATION,
|
||||||
format!("Basic {}", base64::encode(&auth)),
|
format!("Basic {}", base64::encode(auth)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,6 +565,8 @@ mod tests {
|
||||||
assert_eq!(req.head.version, Version::HTTP_2);
|
assert_eq!(req.head.version, Version::HTTP_2);
|
||||||
|
|
||||||
let _ = req.headers_mut();
|
let _ = req.headers_mut();
|
||||||
|
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = req.send_body("");
|
let _ = req.send_body("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ impl WebsocketsRequest {
|
||||||
Some(password) => format!("{}:{}", username, password),
|
Some(password) => format!("{}:{}", username, password),
|
||||||
None => format!("{}:", username),
|
None => format!("{}:", username),
|
||||||
};
|
};
|
||||||
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(&auth)))
|
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(auth)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set HTTP bearer authentication header
|
/// Set HTTP bearer authentication header
|
||||||
|
@ -503,6 +503,8 @@ mod tests {
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
"Bearer someS3cr3tAutht0k3n"
|
"Bearer someS3cr3tAutht0k3n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
let _ = req.connect();
|
let _ = req.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
|
|
Loading…
Reference in a new issue