diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 6297ff41..043e8684 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -75,7 +75,7 @@ impl Options { // Read the MAS_CONFIG environment variable std::env::var("MAS_CONFIG") // Default to "config.yaml" - .unwrap_or_else(|_| "config.yaml".to_string()) + .unwrap_or_else(|_| "config.yaml".to_owned()) // Split the file list on `:` .split(':') .map(PathBuf::from) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index f757d23f..5fbb7519 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all)] +#![deny(clippy::all, clippy::str_to_string)] #![warn(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] diff --git a/crates/config/src/schema.rs b/crates/config/src/schema.rs index 8e0c43b0..e0861ac8 100644 --- a/crates/config/src/schema.rs +++ b/crates/config/src/schema.rs @@ -36,7 +36,7 @@ pub fn port(_gen: &mut SchemaGenerator) -> Schema { pub fn hostname(_gen: &mut SchemaGenerator) -> Schema { Schema::Object(SchemaObject { instance_type: Some(InstanceType::String.into()), - format: Some("hostname".to_string()), + format: Some("hostname".to_owned()), ..SchemaObject::default() }) } diff --git a/crates/config/src/sections/database.rs b/crates/config/src/sections/database.rs index e5847ee7..c65d6357 100644 --- a/crates/config/src/sections/database.rs +++ b/crates/config/src/sections/database.rs @@ -29,7 +29,7 @@ use super::ConfigurationSection; use crate::schema; fn default_connection_string() -> String { - "postgresql://".to_string() + "postgresql://".to_owned() } fn default_max_connections() -> NonZeroU32 { diff --git a/crates/config/src/sections/email.rs b/crates/config/src/sections/email.rs index f7164091..75f57a67 100644 --- a/crates/config/src/sections/email.rs +++ b/crates/config/src/sections/email.rs @@ -28,7 +28,7 @@ use super::ConfigurationSection; fn mailbox_schema(_gen: &mut SchemaGenerator) -> Schema { Schema::Object(SchemaObject { instance_type: Some(InstanceType::String.into()), - format: Some("email".to_string()), + format: Some("email".to_owned()), ..SchemaObject::default() }) } @@ -36,7 +36,7 @@ fn mailbox_schema(_gen: &mut SchemaGenerator) -> Schema { fn hostname_schema(_gen: &mut SchemaGenerator) -> Schema { Schema::Object(SchemaObject { instance_type: Some(InstanceType::String.into()), - format: Some("hostname".to_string()), + format: Some("hostname".to_owned()), ..SchemaObject::default() }) } @@ -107,11 +107,11 @@ impl Default for EmailTransportConfig { fn default_email() -> Mailbox { let address = Address::new("root", "localhost").unwrap(); - Mailbox::new(Some("Authentication Service".to_string()), address) + Mailbox::new(Some("Authentication Service".to_owned()), address) } fn default_sendmail_command() -> String { - "sendmail".to_string() + "sendmail".to_owned() } /// Configuration related to sending emails diff --git a/crates/config/src/sections/matrix.rs b/crates/config/src/sections/matrix.rs index 8bcd1e98..6ae887db 100644 --- a/crates/config/src/sections/matrix.rs +++ b/crates/config/src/sections/matrix.rs @@ -20,7 +20,7 @@ use serde_with::serde_as; use super::ConfigurationSection; fn default_homeserver() -> String { - "localhost:8008".to_string() + "localhost:8008".to_owned() } /// Configuration related to the Matrix homeserver @@ -74,7 +74,7 @@ mod tests { let config = MatrixConfig::load_from_file("config.yaml")?; - assert_eq!(config.homeserver, "matrix.org".to_string()); + assert_eq!(config.homeserver, "matrix.org".to_owned()); Ok(()) }); diff --git a/crates/config/src/sections/policy.rs b/crates/config/src/sections/policy.rs index 0904f3c6..f7fe0993 100644 --- a/crates/config/src/sections/policy.rs +++ b/crates/config/src/sections/policy.rs @@ -22,15 +22,15 @@ use serde_with::serde_as; use super::ConfigurationSection; fn default_client_registration_endpoint() -> String { - "client_registration/violation".to_string() + "client_registration/violation".to_owned() } fn default_register_endpoint() -> String { - "register/violation".to_string() + "register/violation".to_owned() } fn default_authorization_grant_endpoint() -> String { - "authorization_grant/violation".to_string() + "authorization_grant/violation".to_owned() } /// Application secrets diff --git a/crates/config/src/sections/secrets.rs b/crates/config/src/sections/secrets.rs index 6a89f9a1..efc3e7cd 100644 --- a/crates/config/src/sections/secrets.rs +++ b/crates/config/src/sections/secrets.rs @@ -293,7 +293,7 @@ impl ConfigurationSection<'_> for SecretsConfig { Gh7BNzCeN+D6 -----END PRIVATE KEY----- "#} - .to_string(), + .to_owned(), ), }; let ecdsa_key = KeyConfig { @@ -306,7 +306,7 @@ impl ConfigurationSection<'_> for SecretsConfig { OhBAAUVci1RpmUA+KdCL5sw9nadAEiONeiGr+28RYHZmlB9qXnjC -----END PRIVATE KEY----- "#} - .to_string(), + .to_owned(), ), }; diff --git a/crates/data-model/src/lib.rs b/crates/data-model/src/lib.rs index a7539293..344fa708 100644 --- a/crates/data-model/src/lib.rs +++ b/crates/data-model/src/lib.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] #![allow( clippy::module_name_repetitions, diff --git a/crates/data-model/src/tokens.rs b/crates/data-model/src/tokens.rs index a5f93c35..37a67bbf 100644 --- a/crates/data-model/src/tokens.rs +++ b/crates/data-model/src/tokens.rs @@ -153,7 +153,7 @@ impl TokenType { let token_type = TokenType::match_prefix(prefix).ok_or_else(|| TokenFormatError::UnknownPrefix { - prefix: prefix.to_string(), + prefix: prefix.to_owned(), })?; let base = format!("{}_{}", token_type.prefix(), random_part); @@ -162,7 +162,7 @@ impl TokenType { if crc != expected_crc { return Err(TokenFormatError::InvalidCrc { expected: expected_crc, - got: crc.to_string(), + got: crc.to_owned(), }); } diff --git a/crates/data-model/src/users.rs b/crates/data-model/src/users.rs index 12bca9b2..cfb9c00e 100644 --- a/crates/data-model/src/users.rs +++ b/crates/data-model/src/users.rs @@ -34,8 +34,8 @@ where pub fn samples() -> Vec { vec![User { data: Default::default(), - username: "john".to_string(), - sub: "123-456".to_string(), + username: "john".to_owned(), + sub: "123-456".to_owned(), primary_email: None, }] } @@ -147,13 +147,13 @@ where vec![ Self { data: T::UserEmailData::default(), - email: "alice@example.com".to_string(), + email: "alice@example.com".to_owned(), created_at: Utc::now(), confirmed_at: Some(Utc::now()), }, Self { data: T::UserEmailData::default(), - email: "bob@example.com".to_string(), + email: "bob@example.com".to_owned(), created_at: Utc::now(), confirmed_at: None, }, @@ -209,7 +209,7 @@ where .flat_map(|state| { UserEmail::samples().into_iter().map(move |email| Self { data: Default::default(), - code: "123456".to_string(), + code: "123456".to_owned(), email, created_at: Utc::now() - Duration::minutes(10), state: state.clone(), diff --git a/crates/email/src/lib.rs b/crates/email/src/lib.rs index dcca6fff..5adc8aa2 100644 --- a/crates/email/src/lib.rs +++ b/crates/email/src/lib.rs @@ -15,7 +15,12 @@ //! Helps sending emails to users, with different email backends #![forbid(unsafe_code)] -#![deny(clippy::all, missing_docs, rustdoc::broken_intra_doc_links)] +#![deny( + clippy::all, + clippy::str_to_string, + missing_docs, + rustdoc::broken_intra_doc_links +)] #![warn(clippy::pedantic)] mod mailer; diff --git a/crates/handlers/src/compat/login_sso_complete.rs b/crates/handlers/src/compat/login_sso_complete.rs index 6dd7479c..9cce52ea 100644 --- a/crates/handlers/src/compat/login_sso_complete.rs +++ b/crates/handlers/src/compat/login_sso_complete.rs @@ -98,7 +98,7 @@ pub async fn get( if Utc::now() > login.created_at + Duration::minutes(30) { let ctx = ErrorContext::new() .with_code("compat_sso_login_expired") - .with_description("This login session expired.".to_string()); + .with_description("This login session expired.".to_owned()); let content = templates.render_error(&ctx).await?; return Ok((cookie_jar, Html(content)).into_response()); @@ -163,7 +163,7 @@ pub async fn post( if Utc::now() > login.created_at + Duration::minutes(30) { let ctx = ErrorContext::new() .with_code("compat_sso_login_expired") - .with_description("This login session expired.".to_string()); + .with_description("This login session expired.".to_owned()); let content = templates.render_error(&ctx).await?; return Ok((cookie_jar, Html(content)).into_response()); diff --git a/crates/handlers/src/lib.rs b/crates/handlers/src/lib.rs index 13ca13cb..64bf330c 100644 --- a/crates/handlers/src/lib.rs +++ b/crates/handlers/src/lib.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] #![allow( clippy::unused_async // Some axum handlers need that @@ -267,7 +267,7 @@ async fn test_router(pool: &PgPool) -> Result { let url_builder = UrlBuilder::new("https://example.com/".parse()?); let matrix_config = MatrixConfig { - homeserver: "example.com".to_string(), + homeserver: "example.com".to_owned(), }; let policy_factory = PolicyFactory::load_default(serde_json::json!({})).await?; diff --git a/crates/handlers/src/oauth2/discovery.rs b/crates/handlers/src/oauth2/discovery.rs index e601d6d8..77ef1572 100644 --- a/crates/handlers/src/oauth2/discovery.rs +++ b/crates/handlers/src/oauth2/discovery.rs @@ -117,15 +117,15 @@ pub(crate) async fn get( let claim_types_supported = Some(vec![ClaimType::Normal]); let claims_supported = Some(vec![ - "iss".to_string(), - "sub".to_string(), - "aud".to_string(), - "iat".to_string(), - "exp".to_string(), - "nonce".to_string(), - "auth_time".to_string(), - "at_hash".to_string(), - "c_hash".to_string(), + "iss".to_owned(), + "sub".to_owned(), + "aud".to_owned(), + "iat".to_owned(), + "exp".to_owned(), + "nonce".to_owned(), + "auth_time".to_owned(), + "at_hash".to_owned(), + "c_hash".to_owned(), ]); let claims_parameter_supported = Some(false); diff --git a/crates/handlers/src/oauth2/registration.rs b/crates/handlers/src/oauth2/registration.rs index 68fcff91..40622671 100644 --- a/crates/handlers/src/oauth2/registration.rs +++ b/crates/handlers/src/oauth2/registration.rs @@ -93,7 +93,7 @@ impl IntoResponse for RouteError { ( StatusCode::UNAUTHORIZED, Json(PolicyError::new( - "invalid_client_metadata".to_string(), + "invalid_client_metadata".to_owned(), joined, )), ) diff --git a/crates/http/src/layers/otel/make_span_builder.rs b/crates/http/src/layers/otel/make_span_builder.rs index 3b5a0b0d..7f772806 100644 --- a/crates/http/src/layers/otel/make_span_builder.rs +++ b/crates/http/src/layers/otel/make_span_builder.rs @@ -178,11 +178,11 @@ impl MakeSpanBuilder> for SpanFromAxumRequest { } let name = if let Some(path) = request.extensions().get::() { - let path = path.as_str().to_string(); + let path = path.as_str().to_owned(); attributes.push(HTTP_ROUTE.string(path.clone())); path } else { - request.uri().path().to_string() + request.uri().path().to_owned() }; SpanBuilder::from_name(name) @@ -196,7 +196,7 @@ pub struct SpanFromDnsRequest; impl MakeSpanBuilder for SpanFromDnsRequest { fn make_span_builder(&self, request: &Name) -> SpanBuilder { - let attributes = vec![NET_HOST_NAME.string(request.as_str().to_string())]; + let attributes = vec![NET_HOST_NAME.string(request.as_str().to_owned())]; SpanBuilder::from_name("resolve") .with_kind(SpanKind::Client) diff --git a/crates/http/src/layers/otel/on_error.rs b/crates/http/src/layers/otel/on_error.rs index 93634079..9c3bcec2 100644 --- a/crates/http/src/layers/otel/on_error.rs +++ b/crates/http/src/layers/otel/on_error.rs @@ -28,6 +28,6 @@ where { fn on_error(&self, span: &SpanRef<'_>, err: &E) { let attributes = vec![EXCEPTION_MESSAGE.string(err.to_string())]; - span.add_event("exception".to_string(), attributes); + span.add_event("exception".to_owned(), attributes); } } diff --git a/crates/http/src/lib.rs b/crates/http/src/lib.rs index e18b792f..74b48472 100644 --- a/crates/http/src/lib.rs +++ b/crates/http/src/lib.rs @@ -17,6 +17,7 @@ #![forbid(unsafe_code)] #![deny( clippy::all, + clippy::str_to_string, rustdoc::missing_crate_level_docs, rustdoc::broken_intra_doc_links )] diff --git a/crates/iana-codegen/src/main.rs b/crates/iana-codegen/src/main.rs index 476ae4fa..91789e21 100644 --- a/crates/iana-codegen/src/main.rs +++ b/crates/iana-codegen/src/main.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] use std::{collections::HashMap, fmt::Display, path::PathBuf, sync::Arc}; diff --git a/crates/iana-codegen/src/traits.rs b/crates/iana-codegen/src/traits.rs index c5bf4fa0..ba95d820 100644 --- a/crates/iana-codegen/src/traits.rs +++ b/crates/iana-codegen/src/traits.rs @@ -89,8 +89,8 @@ pub trait EnumEntry: DeserializeOwned + Send + Sync { ( key, EnumMember { - value: item.name().to_string(), - description: item.description().map(ToString::to_string), + value: item.name().to_owned(), + description: item.description().map(ToOwned::to_owned), enum_name: item.enum_name(), }, ) diff --git a/crates/iana/src/lib.rs b/crates/iana/src/lib.rs index b754dd14..0a118c1a 100644 --- a/crates/iana/src/lib.rs +++ b/crates/iana/src/lib.rs @@ -15,7 +15,12 @@ //! Values from IANA registries, generated by the `mas-iana-codegen` crate #![forbid(unsafe_code)] -#![deny(clippy::all, missing_docs, rustdoc::broken_intra_doc_links)] +#![deny( + clippy::all, + clippy::str_to_string, + missing_docs, + rustdoc::broken_intra_doc_links +)] #![warn(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] diff --git a/crates/jose/src/claims.rs b/crates/jose/src/claims.rs index 15e5c3b6..b047708a 100644 --- a/crates/jose/src/claims.rs +++ b/crates/jose/src/claims.rs @@ -71,7 +71,7 @@ impl Claim { let value = value.into(); let value: serde_json::Value = serde_json::to_value(&value).map_err(|_| ClaimError::InvalidClaim(self.claim))?; - claims.insert(self.claim.to_string(), value); + claims.insert(self.claim.to_owned(), value); Ok(()) } @@ -365,8 +365,8 @@ mod tests { #[test] fn one_or_many_serde() { - let one = OneOrMany(vec!["one".to_string()]); - let many = OneOrMany(vec!["one".to_string(), "two".to_string()]); + let one = OneOrMany(vec!["one".to_owned()]); + let many = OneOrMany(vec!["one".to_owned(), "two".to_owned()]); assert_eq!( one, @@ -424,13 +424,13 @@ mod tests { .unwrap(); let jti = JTI.extract_optional(&mut claims).unwrap(); - assert_eq!(iss, "https://foo.com".to_string()); - assert_eq!(sub, Some("johndoe".to_string())); - assert_eq!(aud.as_deref(), Some(&vec!["abcd-efgh".to_string()])); + assert_eq!(iss, "https://foo.com".to_owned()); + assert_eq!(sub, Some("johndoe".to_owned())); + assert_eq!(aud.as_deref(), Some(&vec!["abcd-efgh".to_owned()])); assert_eq!(iat.as_deref(), Some(&now)); assert_eq!(nbf.as_deref(), Some(&now)); assert_eq!(exp.as_deref(), Some(&expiration)); - assert_eq!(jti, Some("1122-3344-5566-7788".to_string())); + assert_eq!(jti, Some("1122-3344-5566-7788".to_owned())); assert!(claims.is_empty()); } diff --git a/crates/jose/src/jwt.rs b/crates/jose/src/jwt.rs index 6b698ad7..fa67ad16 100644 --- a/crates/jose/src/jwt.rs +++ b/crates/jose/src/jwt.rs @@ -252,7 +252,7 @@ mod tests { let jwt: DecodedJsonWebToken = jwt.decode_and_verify(&store).await.unwrap(); - assert_eq!(jwt.header.typ, Some("JWT".to_string())); + assert_eq!(jwt.header.typ, Some("JWT".to_owned())); assert_eq!(jwt.header.alg, JsonWebSignatureAlg::Hs256); assert_eq!( jwt.payload, diff --git a/crates/jose/src/lib.rs b/crates/jose/src/lib.rs index 56255067..41ac03b7 100644 --- a/crates/jose/src/lib.rs +++ b/crates/jose/src/lib.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] #![allow(clippy::missing_errors_doc, clippy::module_name_repetitions)] diff --git a/crates/oauth2-types/src/lib.rs b/crates/oauth2-types/src/lib.rs index fc7fd108..c6aed87e 100644 --- a/crates/oauth2-types/src/lib.rs +++ b/crates/oauth2-types/src/lib.rs @@ -13,7 +13,7 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] use mas_iana::oauth::OAuthAuthorizationEndpointResponseType; diff --git a/crates/oauth2-types/src/webfinger.rs b/crates/oauth2-types/src/webfinger.rs index 20670e95..bfc9001b 100644 --- a/crates/oauth2-types/src/webfinger.rs +++ b/crates/oauth2-types/src/webfinger.rs @@ -64,7 +64,7 @@ mod tests { #[test] fn serialize_webfinger_response_test() { - let res = WebFingerResponse::new("acct:john@example.com".to_string()) + let res = WebFingerResponse::new("acct:john@example.com".to_owned()) .with_issuer(Url::parse("https://account.example.com/").unwrap()); let res = serde_json::to_value(&res).unwrap(); diff --git a/crates/policy/src/lib.rs b/crates/policy/src/lib.rs index d4070242..b2cfb38d 100644 --- a/crates/policy/src/lib.rs +++ b/crates/policy/src/lib.rs @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![forbid(unsafe_code)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] +#![warn(clippy::pedantic)] +#![allow(clippy::missing_errors_doc)] + use std::io::Cursor; use anyhow::bail; @@ -25,6 +30,7 @@ use wasmtime::{Config, Engine, Module, Store}; const DEFAULT_POLICY: &[u8] = include_bytes!("../policies/policy.wasm"); +#[must_use] pub fn default_wasm_policy() -> impl AsyncRead + std::marker::Unpin { Cursor::new(DEFAULT_POLICY) } @@ -109,9 +115,9 @@ impl PolicyFactory { Self::load( default_wasm_policy(), data, - "register/violation".to_string(), - "client_registration/violation".to_string(), - "authorization_grant/violation".to_string(), + "register/violation".to_owned(), + "client_registration/violation".to_owned(), + "authorization_grant/violation".to_owned(), ) .await } @@ -158,6 +164,7 @@ pub struct EvaluationResult { } impl EvaluationResult { + #[must_use] pub fn valid(&self) -> bool { self.violations.is_empty() } diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index 06106e51..753613fe 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -12,7 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![deny(clippy::pedantic)] +#![forbid(unsafe_code)] +#![deny( + clippy::all, + clippy::pedantic, + clippy::str_to_string, + rustdoc::broken_intra_doc_links +)] pub(crate) mod endpoints; pub(crate) mod traits; diff --git a/crates/static-files/src/lib.rs b/crates/static-files/src/lib.rs index 82a5a012..b6e60eee 100644 --- a/crates/static-files/src/lib.rs +++ b/crates/static-files/src/lib.rs @@ -15,7 +15,12 @@ //! Serve static files used by the web frontend #![forbid(unsafe_code)] -#![deny(clippy::all, missing_docs, rustdoc::broken_intra_doc_links)] +#![deny( + clippy::all, + clippy::str_to_string, + missing_docs, + rustdoc::broken_intra_doc_links +)] #![warn(clippy::pedantic)] #[cfg(not(feature = "dev"))] diff --git a/crates/storage/src/compat.rs b/crates/storage/src/compat.rs index 55a28653..5aa32a43 100644 --- a/crates/storage/src/compat.rs +++ b/crates/storage/src/compat.rs @@ -317,7 +317,7 @@ pub async fn compat_login( // TODO: pass verifiers list as parameter // Verify the password in a blocking thread to avoid blocking the async executor - let password = password.to_string(); + let password = password.to_owned(); task::spawn_blocking(move || { let context = Argon2::default(); let hasher = PasswordHash::new(&hashed_password)?; diff --git a/crates/storage/src/lib.rs b/crates/storage/src/lib.rs index 21a2194e..d015777e 100644 --- a/crates/storage/src/lib.rs +++ b/crates/storage/src/lib.rs @@ -15,7 +15,7 @@ //! Interactions with the database #![forbid(unsafe_code)] -#![deny(clippy::all, rustdoc::broken_intra_doc_links)] +#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)] #![warn(clippy::pedantic)] #![allow( clippy::missing_errors_doc, diff --git a/crates/storage/src/oauth2/access_token.rs b/crates/storage/src/oauth2/access_token.rs index 56cbc8a9..0b585823 100644 --- a/crates/storage/src/oauth2/access_token.rs +++ b/crates/storage/src/oauth2/access_token.rs @@ -51,7 +51,7 @@ pub async fn add_access_token( Ok(AccessToken { data: res.id, expires_after, - token: token.to_string(), + token: token.to_owned(), jti: format!("{}", res.id), created_at: res.created_at, }) diff --git a/crates/storage/src/oauth2/refresh_token.rs b/crates/storage/src/oauth2/refresh_token.rs index aae65257..2452a87e 100644 --- a/crates/storage/src/oauth2/refresh_token.rs +++ b/crates/storage/src/oauth2/refresh_token.rs @@ -49,7 +49,7 @@ pub async fn add_refresh_token( Ok(RefreshToken { data: res.id, - token: token.to_string(), + token: token.to_owned(), access_token: Some(access_token), created_at: res.created_at, }) diff --git a/crates/storage/src/user.rs b/crates/storage/src/user.rs index 22115d9f..99c6d3f2 100644 --- a/crates/storage/src/user.rs +++ b/crates/storage/src/user.rs @@ -73,7 +73,7 @@ pub async fn login( .map_err(|source| { if source.not_found() { LoginError::NotFound { - username: username.to_string(), + username: username.to_owned(), source, } } else { @@ -87,7 +87,7 @@ pub async fn login( .map_err(|source| { if matches!(source, AuthenticationError::Password { .. }) { LoginError::Authentication { - username: username.to_string(), + username: username.to_owned(), source, } } else { @@ -297,7 +297,7 @@ pub async fn authenticate_session( // TODO: pass verifiers list as parameter // Verify the password in a blocking thread to avoid blocking the async executor - let password = password.to_string(); + let password = password.to_owned(); task::spawn_blocking(move || { let context = Argon2::default(); let hasher = PasswordHash::new(&hashed_password).map_err(AuthenticationError::Password)?; @@ -353,7 +353,7 @@ pub async fn register_user( let user = User { data: id, - username: username.to_string(), + username: username.to_owned(), sub: format!("fake-sub-{}", id), primary_email: None, }; diff --git a/crates/tasks/src/lib.rs b/crates/tasks/src/lib.rs index 93e1d983..a154afe7 100644 --- a/crates/tasks/src/lib.rs +++ b/crates/tasks/src/lib.rs @@ -19,7 +19,12 @@ //! considered "good enough" for now. #![forbid(unsafe_code)] -#![deny(clippy::all, missing_docs, rustdoc::broken_intra_doc_links)] +#![deny( + clippy::all, + clippy::str_to_string, + missing_docs, + rustdoc::broken_intra_doc_links +)] #![warn(clippy::pedantic)] use std::{collections::VecDeque, sync::Arc, time::Duration}; diff --git a/crates/templates/src/context.rs b/crates/templates/src/context.rs index 28b56a79..a6e3cffa 100644 --- a/crates/templates/src/context.rs +++ b/crates/templates/src/context.rs @@ -281,7 +281,7 @@ impl TemplateContext for LoginContext { vec![LoginContext { form: FormState::default(), next: None, - register_link: "/register".to_string(), + register_link: "/register".to_owned(), }] } } @@ -355,7 +355,7 @@ impl TemplateContext for RegisterContext { vec![RegisterContext { form: FormState::default(), next: None, - login_link: "/login".to_string(), + login_link: "/login".to_owned(), }] } } @@ -621,14 +621,14 @@ impl TemplateContext for EmailVerificationContext { .map(|user| { let email = UserEmail { data: (), - email: "foobar@example.com".to_string(), + email: "foobar@example.com".to_owned(), created_at: Utc::now(), confirmed_at: None, }; let verification = UserEmailVerification { data: (), - code: "123456".to_string(), + code: "123456".to_owned(), email, created_at: Utc::now(), state: mas_data_model::UserEmailVerificationState::Valid, @@ -690,7 +690,7 @@ impl TemplateContext for EmailVerificationPageContext { { let email = UserEmail { data: (), - email: "foobar@example.com".to_string(), + email: "foobar@example.com".to_owned(), created_at: Utc::now(), confirmed_at: None, }; diff --git a/crates/templates/src/forms.rs b/crates/templates/src/forms.rs index 26000eda..d1eb4502 100644 --- a/crates/templates/src/forms.rs +++ b/crates/templates/src/forms.rs @@ -203,8 +203,8 @@ mod tests { #[test] fn form_state_serialization() { let form = TestForm { - foo: "john".to_string(), - bar: "hunter2".to_string(), + foo: "john".to_owned(), + bar: "hunter2".to_owned(), }; let state = form.to_form_state(); @@ -227,8 +227,8 @@ mod tests { ); let form = TestForm { - foo: "".to_string(), - bar: "".to_string(), + foo: "".to_owned(), + bar: "".to_owned(), }; let state = form .to_form_state() diff --git a/crates/templates/src/lib.rs b/crates/templates/src/lib.rs index 134648fe..3ab7e974 100644 --- a/crates/templates/src/lib.rs +++ b/crates/templates/src/lib.rs @@ -13,7 +13,12 @@ // limitations under the License. #![forbid(unsafe_code)] -#![deny(clippy::all, missing_docs, rustdoc::broken_intra_doc_links)] +#![deny( + clippy::all, + clippy::str_to_string, + missing_docs, + rustdoc::broken_intra_doc_links +)] #![warn(clippy::pedantic)] #![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)]