diff --git a/actix-identity/tests/integration/test_app.rs b/actix-identity/tests/integration/test_app.rs index 9ff493e3f..89ba665ed 100644 --- a/actix-identity/tests/integration/test_app.rs +++ b/actix-identity/tests/integration/test_app.rs @@ -32,7 +32,8 @@ impl TestApp { .listen(listener) .unwrap() .run(); - let _ = actix_web::rt::spawn(server); + + actix_web::rt::spawn(server); let client = reqwest::Client::builder() .cookie_store(true) diff --git a/actix-limitation/tests/tests.rs b/actix-limitation/tests/tests.rs index 07df6eb1a..fa6f1ae1d 100644 --- a/actix-limitation/tests/tests.rs +++ b/actix-limitation/tests/tests.rs @@ -21,7 +21,7 @@ async fn test_limiter_count() -> Result<(), Error> { for i in 0..20 { let status = limiter.count(id.to_string()).await?; - println!("status: {:?}", status); + println!("status: {status:?}"); assert_eq!(20 - status.remaining(), i + 1); } diff --git a/actix-protobuf/src/lib.rs b/actix-protobuf/src/lib.rs index 743a51d56..f2f7e0160 100644 --- a/actix-protobuf/src/lib.rs +++ b/actix-protobuf/src/lib.rs @@ -39,15 +39,15 @@ pub enum ProtoBufPayloadError { ContentType, /// Serialize error - #[display(fmt = "ProtoBuf serialize error: {}", _0)] + #[display(fmt = "ProtoBuf serialize error: {_0}")] Serialize(ProtoBufEncodeError), /// Deserialize error - #[display(fmt = "ProtoBuf deserialize error: {}", _0)] + #[display(fmt = "ProtoBuf deserialize error: {_0}")] Deserialize(ProtoBufDecodeError), /// Payload error - #[display(fmt = "Error that occur during reading payload: {}", _0)] + #[display(fmt = "Error that occur during reading payload: {_0}")] Payload(PayloadError), } diff --git a/actix-redis/src/lib.rs b/actix-redis/src/lib.rs index e7cd980c8..6d0ca7c40 100644 --- a/actix-redis/src/lib.rs +++ b/actix-redis/src/lib.rs @@ -13,7 +13,7 @@ pub use self::redis::{Command, RedisActor}; /// General purpose `actix-redis` error. #[derive(Debug, Display, Error, From)] pub enum Error { - #[display(fmt = "Redis error: {}", _0)] + #[display(fmt = "Redis error: {_0}")] Redis(redis_async::error::Error), /// Receiving message during reconnecting. diff --git a/actix-redis/tests/test_redis.rs b/actix-redis/tests/test_redis.rs index 6ae83f1e1..fa2f88f26 100644 --- a/actix-redis/tests/test_redis.rs +++ b/actix-redis/tests/test_redis.rs @@ -31,7 +31,7 @@ async fn test_redis() { let res = addr.send(Command(resp_array!["GET", "test"])).await; match res { Ok(Ok(resp)) => { - println!("RESP: {:?}", resp); + println!("RESP: {resp:?}"); assert_eq!(resp, RespValue::BulkString((&b"value"[..]).into())); } _ => panic!("Should not happen {:?}", res), diff --git a/actix-session/examples/basic.rs b/actix-session/examples/basic.rs index 3f41c68dc..f1f08ae66 100644 --- a/actix-session/examples/basic.rs +++ b/actix-session/examples/basic.rs @@ -3,11 +3,11 @@ use actix_web::{cookie::Key, middleware, web, App, Error, HttpRequest, HttpServe /// simple handler async fn index(req: HttpRequest, session: Session) -> Result { - println!("{:?}", req); + println!("{req:?}"); // session if let Some(count) = session.get::("counter")? { - println!("SESSION value: {}", count); + println!("SESSION value: {count}"); session.insert("counter", count + 1)?; } else { session.insert("counter", 1)?; diff --git a/actix-session/src/lib.rs b/actix-session/src/lib.rs index 0a8d5587f..6c6615ef6 100644 --- a/actix-session/src/lib.rs +++ b/actix-session/src/lib.rs @@ -179,7 +179,7 @@ pub mod test_helpers { CookieContentSecurity::Signed, CookieContentSecurity::Private, ] { - println!("Using {:?} as cookie content security policy.", policy); + println!("Using {policy:?} as cookie content security policy."); acceptance_tests::basic_workflow(store_builder.clone(), *policy).await; acceptance_tests::expiration_is_refreshed_on_changes(store_builder.clone(), *policy) .await; @@ -243,7 +243,7 @@ pub mod test_helpers { })) .service(web::resource("/test/").to(|ses: Session| async move { let val: usize = ses.get("counter").unwrap().unwrap(); - format!("counter: {}", val) + format!("counter: {val}") })), ) .await; @@ -710,9 +710,9 @@ pub mod test_helpers { async fn logout(session: Session) -> Result { let id: Option = session.get("user_id")?; - let body = if let Some(x) = id { + let body = if let Some(id) = id { session.purge(); - format!("Logged out: {}", x) + format!("Logged out: {id}") } else { "Could not log out anonymous user".to_owned() }; diff --git a/actix-session/src/session.rs b/actix-session/src/session.rs index 35aaaa3f2..3a056e1ba 100644 --- a/actix-session/src/session.rs +++ b/actix-session/src/session.rs @@ -291,7 +291,7 @@ impl FromRequest for Session { /// Error returned by [`Session::get`]. #[derive(Debug, Display, From)] -#[display(fmt = "{}", _0)] +#[display(fmt = "{_0}")] pub struct SessionGetError(anyhow::Error); impl StdError for SessionGetError { @@ -308,7 +308,7 @@ impl ResponseError for SessionGetError { /// Error returned by [`Session::insert`]. #[derive(Debug, Display, From)] -#[display(fmt = "{}", _0)] +#[display(fmt = "{_0}")] pub struct SessionInsertError(anyhow::Error); impl StdError for SessionInsertError { diff --git a/actix-settings/src/error.rs b/actix-settings/src/error.rs index f3834cf45..f59e355f0 100644 --- a/actix-settings/src/error.rs +++ b/actix-settings/src/error.rs @@ -89,7 +89,7 @@ impl From for io::Error { fn from(err: Error) -> Self { match err { Error::EnvVarError(var_error) => { - let msg = format!("Env var error: {}", var_error); + let msg = format!("Env var error: {var_error}"); io::Error::new(io::ErrorKind::InvalidInput, msg) } @@ -105,32 +105,29 @@ impl From for io::Error { line, column, } => { - let msg = format!( - "Expected {}, got {} (@ {}:{}:{})", - expected, got, file, line, column - ); + let msg = format!("Expected {expected}, got {got} (@ {file}:{line}:{column})"); io::Error::new(io::ErrorKind::InvalidInput, msg) } Error::IoError(io_error) => io_error.into(), Error::ParseBoolError(parse_bool_error) => { - let msg = format!("Failed to parse boolean: {}", parse_bool_error); + let msg = format!("Failed to parse boolean: {parse_bool_error}"); io::Error::new(io::ErrorKind::InvalidInput, msg) } Error::ParseIntError(parse_int_error) => { - let msg = format!("Failed to parse integer: {}", parse_int_error); + let msg = format!("Failed to parse integer: {parse_int_error}"); io::Error::new(io::ErrorKind::InvalidInput, msg) } Error::ParseAddressError(string) => { - let msg = format!("Failed to parse address: {}", string); + let msg = format!("Failed to parse address: {string}"); io::Error::new(io::ErrorKind::InvalidInput, msg) } Error::TomlError(toml_error) => { - let msg = format!("TOML error: {}", toml_error); + let msg = format!("TOML error: {toml_error}"); io::Error::new(io::ErrorKind::InvalidInput, msg) } } diff --git a/actix-settings/src/lib.rs b/actix-settings/src/lib.rs index 8383dc015..a0d0e3024 100644 --- a/actix-settings/src/lib.rs +++ b/actix-settings/src/lib.rs @@ -274,7 +274,7 @@ where todo!("[ApplySettings] TLS support has not been implemented yet."); } else { for Address { host, port } in &settings.actix.hosts { - self = self.bind(format!("{}:{}", host, port)) + self = self.bind(format!("{host}:{port}")) .unwrap(/*TODO*/); } } diff --git a/actix-web-httpauth/examples/with-cors.rs b/actix-web-httpauth/examples/with-cors.rs index 4f034a295..a5e37d881 100644 --- a/actix-web-httpauth/examples/with-cors.rs +++ b/actix-web-httpauth/examples/with-cors.rs @@ -6,7 +6,7 @@ async fn ok_validator( req: ServiceRequest, credentials: BearerAuth, ) -> Result { - eprintln!("{:?}", credentials); + eprintln!("{credentials:?}"); Ok(req) } diff --git a/actix-web-httpauth/src/headers/authorization/errors.rs b/actix-web-httpauth/src/headers/authorization/errors.rs index a203f6312..465156897 100644 --- a/actix-web-httpauth/src/headers/authorization/errors.rs +++ b/actix-web-httpauth/src/headers/authorization/errors.rs @@ -32,7 +32,7 @@ impl fmt::Display for ParseError { match self { ParseError::Invalid => f.write_str("Invalid header value"), ParseError::MissingScheme => f.write_str("Missing authorization scheme"), - ParseError::MissingField(field) => write!(f, "Missing header field ({})", field), + ParseError::MissingField(field) => write!(f, "Missing header field ({field})"), ParseError::ToStrError(err) => fmt::Display::fmt(err, f), ParseError::Base64DecodeError(err) => fmt::Display::fmt(err, f), ParseError::Utf8Error(err) => fmt::Display::fmt(err, f), diff --git a/actix-web-httpauth/src/headers/www_authenticate/challenge/bearer/mod.rs b/actix-web-httpauth/src/headers/www_authenticate/challenge/bearer/mod.rs index f957dedc4..8c180b151 100644 --- a/actix-web-httpauth/src/headers/www_authenticate/challenge/bearer/mod.rs +++ b/actix-web-httpauth/src/headers/www_authenticate/challenge/bearer/mod.rs @@ -12,14 +12,14 @@ mod tests { #[test] fn to_bytes() { - let b = Bearer::build() + let bearer = Bearer::build() .error(Error::InvalidToken) .error_description("Subject 8740827c-2e0a-447b-9716-d73042e4039d not found") .finish(); assert_eq!( "Bearer error=\"invalid_token\" error_description=\"Subject 8740827c-2e0a-447b-9716-d73042e4039d not found\"", - format!("{}", b) + format!("{bearer}") ); } }