diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 1e385455..665d3755 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -20,7 +20,7 @@ jobs: - name: Install toolchain uses: actions-rs/toolchain@v1 with: - toolchain: "1.54.0" # MSRV + toolchain: "1.56.0" # MSRV target: x86_64-unknown-linux-musl profile: minimal override: true @@ -192,7 +192,7 @@ jobs: fail-fast: false # Continue other jobs if one fails to help filling the cache matrix: toolchain: - - "1.54.0" # MSRV + - "1.56.0" # MSRV - stable - beta - nightly diff --git a/Cargo.toml b/Cargo.toml index bcc77e62..d02b0e9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ [workspace] members = ["crates/*"] - -resolver = "2" diff --git a/clippy.toml b/clippy.toml index 0f31b88d..0d369b50 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.54.0" +msrv = "1.56.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 339bf2e0..ae362528 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-cli" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [dependencies] diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 67055ea9..8291ac4c 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-config" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [dependencies] diff --git a/crates/config/src/database.rs b/crates/config/src/database.rs index f37cfd00..c41abc2e 100644 --- a/crates/config/src/database.rs +++ b/crates/config/src/database.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{convert::TryInto, path::PathBuf, time::Duration}; +use std::{path::PathBuf, time::Duration}; use anyhow::Context; use async_trait::async_trait; diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index f3aa92e7..62c86580 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -12,6 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![forbid(unsafe_code)] +#![deny(clippy::all)] +#![deny(rustdoc::broken_intra_doc_links)] +#![warn(clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] +#![allow(clippy::missing_panics_doc)] +#![allow(clippy::missing_errors_doc)] + use async_trait::async_trait; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/config/src/oauth2.rs b/crates/config/src/oauth2.rs index 0d472571..cce58067 100644 --- a/crates/config/src/oauth2.rs +++ b/crates/config/src/oauth2.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use anyhow::Context; use async_trait::async_trait; use jwt_compact::{ @@ -67,6 +65,7 @@ pub struct Jwks { pub struct KeySet(Vec); impl KeySet { + #[must_use] pub fn to_public_jwks(&self) -> Jwks { let keys = self.0.iter().map(Key::to_public_jwk).collect(); Jwks { keys } @@ -345,6 +344,7 @@ pub struct OAuth2Config { } impl OAuth2Config { + #[must_use] pub fn discovery_url(&self) -> Url { self.issuer .join(".well-known/openid-configuration") diff --git a/crates/config/src/telemetry.rs b/crates/config/src/telemetry.rs index 2b1a41b1..bf398b09 100644 --- a/crates/config/src/telemetry.rs +++ b/crates/config/src/telemetry.rs @@ -107,10 +107,10 @@ impl ConfigurationSection<'_> for TelemetryConfig { } async fn generate() -> anyhow::Result { - Ok(Default::default()) + Ok(Self::default()) } fn test() -> Self { - Default::default() + Self::default() } } diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index eb99114d..9b64fe83 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-core" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [features] diff --git a/crates/core/src/handlers/oauth2/authorization.rs b/crates/core/src/handlers/oauth2/authorization.rs index ecadbf97..3d586ec4 100644 --- a/crates/core/src/handlers/oauth2/authorization.rs +++ b/crates/core/src/handlers/oauth2/authorization.rs @@ -12,10 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{ - collections::{HashMap, HashSet}, - convert::TryFrom, -}; +use std::collections::{HashMap, HashSet}; use chrono::Duration; use hyper::{ diff --git a/crates/core/src/handlers/views/login.rs b/crates/core/src/handlers/views/login.rs index 5fe60612..432e8a6c 100644 --- a/crates/core/src/handlers/views/login.rs +++ b/crates/core/src/handlers/views/login.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use hyper::http::uri::{Parts, PathAndQuery, Uri}; use mas_config::{CookiesConfig, CsrfConfig}; use mas_data_model::{errors::WrapFormError, BrowserSession, StorageBackend}; diff --git a/crates/core/src/handlers/views/reauth.rs b/crates/core/src/handlers/views/reauth.rs index ceadc113..859341ae 100644 --- a/crates/core/src/handlers/views/reauth.rs +++ b/crates/core/src/handlers/views/reauth.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use hyper::http::uri::{Parts, PathAndQuery}; use mas_config::{CookiesConfig, CsrfConfig}; use mas_data_model::{BrowserSession, StorageBackend}; diff --git a/crates/core/src/handlers/views/register.rs b/crates/core/src/handlers/views/register.rs index 5cb72445..bfe1e5f2 100644 --- a/crates/core/src/handlers/views/register.rs +++ b/crates/core/src/handlers/views/register.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use argon2::Argon2; use hyper::http::uri::{Parts, PathAndQuery, Uri}; use mas_config::{CookiesConfig, CsrfConfig}; diff --git a/crates/core/src/storage/oauth2/access_token.rs b/crates/core/src/storage/oauth2/access_token.rs index 80fe575e..d8f1aa67 100644 --- a/crates/core/src/storage/oauth2/access_token.rs +++ b/crates/core/src/storage/oauth2/access_token.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use anyhow::Context; use chrono::{DateTime, Duration, Utc}; use mas_data_model::{AccessToken, Authentication, BrowserSession, Client, Session, User}; diff --git a/crates/core/src/storage/oauth2/authorization_grant.rs b/crates/core/src/storage/oauth2/authorization_grant.rs index 6558c7d9..0e1972b6 100644 --- a/crates/core/src/storage/oauth2/authorization_grant.rs +++ b/crates/core/src/storage/oauth2/authorization_grant.rs @@ -14,10 +14,7 @@ #![allow(clippy::unused_async)] -use std::{ - convert::{TryFrom, TryInto}, - num::NonZeroU32, -}; +use std::num::NonZeroU32; use anyhow::Context; use chrono::{DateTime, Utc}; diff --git a/crates/core/src/storage/user.rs b/crates/core/src/storage/user.rs index 93f3cf99..91f590dd 100644 --- a/crates/core/src/storage/user.rs +++ b/crates/core/src/storage/user.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{borrow::BorrowMut, convert::TryInto}; +use std::borrow::BorrowMut; use anyhow::Context; use argon2::Argon2; diff --git a/crates/core/src/tokens.rs b/crates/core/src/tokens.rs index 64403b7f..52fbc61c 100644 --- a/crates/core/src/tokens.rs +++ b/crates/core/src/tokens.rs @@ -37,8 +37,6 @@ #![deny(missing_docs)] -use std::convert::TryInto; - use crc::{Crc, CRC_32_ISO_HDLC}; use oauth2_types::requests::TokenTypeHint; use rand::{distributions::Alphanumeric, Rng}; diff --git a/crates/data-model/Cargo.toml b/crates/data-model/Cargo.toml index fa55b3a5..4c57b5ee 100644 --- a/crates/data-model/Cargo.toml +++ b/crates/data-model/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-data-model" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [dependencies] diff --git a/crates/data-model/src/lib.rs b/crates/data-model/src/lib.rs index 0f392a65..919eba53 100644 --- a/crates/data-model/src/lib.rs +++ b/crates/data-model/src/lib.rs @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![forbid(unsafe_code)] +#![deny(clippy::all)] +#![deny(rustdoc::broken_intra_doc_links)] +#![warn(clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] +#![allow(clippy::missing_panics_doc)] +#![allow(clippy::missing_errors_doc)] +#![allow(clippy::trait_duplication_in_bounds)] + pub mod errors; pub(crate) mod oauth2; pub(crate) mod tokens; diff --git a/crates/data-model/src/oauth2/authorization_grant.rs b/crates/data-model/src/oauth2/authorization_grant.rs index ddcc9f45..a7ccf1f2 100644 --- a/crates/data-model/src/oauth2/authorization_grant.rs +++ b/crates/data-model/src/oauth2/authorization_grant.rs @@ -30,6 +30,7 @@ pub struct Pkce { } impl Pkce { + #[must_use] pub fn new(challenge_method: CodeChallengeMethod, challenge: String) -> Self { Pkce { challenge_method, @@ -37,6 +38,7 @@ impl Pkce { } } + #[must_use] pub fn verify(&self, verifier: &str) -> bool { self.challenge_method.verify(&self.challenge, verifier) } @@ -77,6 +79,7 @@ impl Default for AuthorizationGrantStage { } impl AuthorizationGrantStage { + #[must_use] pub fn new() -> Self { Self::Pending } @@ -119,7 +122,7 @@ impl AuthorizationGrantStage { impl From> for AuthorizationGrantStage<()> { fn from(s: AuthorizationGrantStage) -> Self { - use AuthorizationGrantStage::*; + use AuthorizationGrantStage::{Cancelled, Exchanged, Fulfilled, Pending}; match s { Pending => Pending, Fulfilled { diff --git a/crates/data-model/src/users.rs b/crates/data-model/src/users.rs index cc9dce63..7ee592ae 100644 --- a/crates/data-model/src/users.rs +++ b/crates/data-model/src/users.rs @@ -30,6 +30,7 @@ impl User where T::UserData: Default, { + #[must_use] pub fn samples() -> Vec { vec![User { data: Default::default(), @@ -92,6 +93,7 @@ where T::BrowserSessionData: Default, T::UserData: Default, { + #[must_use] pub fn samples() -> Vec { User::::samples() .into_iter() diff --git a/crates/oauth2-types/Cargo.toml b/crates/oauth2-types/Cargo.toml index 8c59860b..657ede54 100644 --- a/crates/oauth2-types/Cargo.toml +++ b/crates/oauth2-types/Cargo.toml @@ -2,7 +2,7 @@ name = "oauth2-types" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [dependencies] diff --git a/crates/static-files/Cargo.toml b/crates/static-files/Cargo.toml index 26525451..c0f79281 100644 --- a/crates/static-files/Cargo.toml +++ b/crates/static-files/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-static-files" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [features] diff --git a/crates/static-files/src/lib.rs b/crates/static-files/src/lib.rs index 9a9a7867..b97387eb 100644 --- a/crates/static-files/src/lib.rs +++ b/crates/static-files/src/lib.rs @@ -27,7 +27,7 @@ use warp::{filters::BoxedFilter, Filter, Reply}; #[cfg(not(feature = "dev"))] mod builtin { - use std::{convert::TryInto, fmt::Write, str::FromStr}; + use std::{fmt::Write, str::FromStr}; use headers::{ContentLength, ContentType, ETag, HeaderMapExt}; use rust_embed::RustEmbed; diff --git a/crates/templates/Cargo.toml b/crates/templates/Cargo.toml index 0936c3e5..9045ab28 100644 --- a/crates/templates/Cargo.toml +++ b/crates/templates/Cargo.toml @@ -2,7 +2,7 @@ name = "mas-templates" version = "0.1.0" authors = ["Quentin Gliech "] -edition = "2018" +edition = "2021" license = "Apache-2.0" [features]