1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-25 17:40:36 +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:
Rob Ede 2023-01-01 20:56:27 +00:00
parent 06c3513bc0
commit 6f0a6bd1bb
No known key found for this signature in database
GPG key ID: 97C636207D3EF933
31 changed files with 52 additions and 10 deletions

View file

@ -13,6 +13,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible, missing_docs, missing_debug_implementations)]
#![allow(clippy::uninlined_format_args)]
use actix_service::boxed::{BoxService, BoxServiceFactory};
use actix_web::{

View file

@ -2,6 +2,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(clippy::uninlined_format_args)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![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
// all thread managed resources should be dropped at this point
#[allow(clippy::let_underscore_future)]
let _ = thread_stop_tx.send(());
});
@ -294,6 +296,7 @@ impl Drop for TestServer {
// without needing to await anything
// signal server to stop
#[allow(clippy::let_underscore_future)]
let _ = self.server.stop(true);
// signal system to stop

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
const CODES: &[u16] = &[0, 1000, 201, 800, 550];

View file

@ -44,7 +44,7 @@ where
#[inline]
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`].

View file

@ -71,7 +71,7 @@ impl ChunkedState {
match size.checked_mul(radix) {
Some(n) => {
*size = n as u64;
*size = n;
*size += rem as u64;
Poll::Ready(Ok(ChunkedState::Size))

View file

@ -450,7 +450,7 @@ impl TransferEncoding {
buf.extend_from_slice(&msg[..len as usize]);
*remaining -= len as u64;
*remaining -= len;
Ok(*remaining == 0)
} else {
Ok(true)

View file

@ -21,7 +21,8 @@
#![allow(
clippy::type_complexity,
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_favicon_url = "https://actix.rs/favicon.ico")]

View file

@ -1,4 +1,5 @@
#![cfg(feature = "openssl")]
#![allow(clippy::uninlined_format_args)]
extern crate tls_openssl as openssl;

View file

@ -1,4 +1,5 @@
#![cfg(feature = "rustls")]
#![allow(clippy::uninlined_format_args)]
extern crate tls_rustls as rustls;

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use std::{
convert::Infallible,
io::{Read, Write},

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use std::{
cell::Cell,
convert::Infallible,

View file

@ -2,7 +2,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(clippy::borrow_interior_mutable_const)]
#![allow(clippy::borrow_interior_mutable_const, clippy::uninlined_format_args)]
mod error;
mod extractor;

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use std::borrow::Cow;

View file

@ -2,6 +2,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(clippy::uninlined_format_args)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]

View file

@ -321,6 +321,7 @@ where
// all thread managed resources should be dropped at this point
});
#[allow(clippy::let_underscore_future)]
let _ = thread_stop_tx.send(());
});
@ -567,6 +568,7 @@ impl Drop for TestServer {
// without needing to await anything
// signal server to stop
#[allow(clippy::let_underscore_future)]
let _ = self.server.stop(true);
// signal system to stop

View file

@ -57,6 +57,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(clippy::uninlined_format_args)]
mod context;
pub mod ws;

View file

@ -155,7 +155,7 @@ impl Args {
if !methods.insert(method) {
return Err(syn::Error::new_spanned(
&nv.lit,
&format!(
format!(
"HTTP method defined more than once: `{}`",
lit.value()
),

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use actix_web::{web, App, HttpResponse};
use awc::Client;
use criterion::{criterion_group, criterion_main, Criterion};

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer};
#[get("/resource1/{name}/index.html")]

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
async fn index(req: HttpRequest) -> &'static str {

View file

@ -4,6 +4,8 @@
//! For an example of extracting a client TLS certificate, see:
//! <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 actix_web::{

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use actix_web::{get, web, HttpRequest};
#[cfg(unix)]
use actix_web::{middleware, App, Error, HttpResponse, HttpServer};

View file

@ -712,6 +712,7 @@ mod tests {
.route("/", web::to(|| async { "hello" }))
}
#[allow(clippy::let_underscore_future)]
let _ = init_service(my_app());
}
}

View file

@ -69,6 +69,7 @@
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible)]
#![allow(clippy::uninlined_format_args)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_cfg))]

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
#[cfg(feature = "openssl")]
extern crate tls_openssl as openssl;

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use std::error::Error as StdError;
#[tokio::main]

View file

@ -210,7 +210,7 @@ where
};
self.add_default_header((
header::AUTHORIZATION,
format!("Basic {}", base64::encode(&auth)),
format!("Basic {}", base64::encode(auth)),
))
}

View file

@ -105,7 +105,8 @@
#![allow(
clippy::type_complexity,
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_favicon_url = "https://actix.rs/favicon.ico")]

View file

@ -238,7 +238,7 @@ impl ClientRequest {
self.insert_header((
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);
let _ = req.headers_mut();
#[allow(clippy::let_underscore_future)]
let _ = req.send_body("");
}

View file

@ -236,7 +236,7 @@ impl WebsocketsRequest {
Some(password) => format!("{}:{}", username, password),
None => format!("{}:", username),
};
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(&auth)))
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(auth)))
}
/// Set HTTP bearer authentication header
@ -503,6 +503,8 @@ mod tests {
.unwrap(),
"Bearer someS3cr3tAutht0k3n"
);
#[allow(clippy::let_underscore_future)]
let _ = req.connect();
}

View file

@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]
use std::{
collections::HashMap,
convert::Infallible,