1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-21 23:00:50 +03:00

Enable clippy lints on iana crates

This commit is contained in:
Quentin Gliech
2022-01-12 12:26:35 +01:00
parent 5b9c35a079
commit 219035335c
4 changed files with 26 additions and 13 deletions

View File

@@ -98,7 +98,7 @@ impl EnumEntry for WebEncryptionSignatureAlgorithm {
} }
} }
Usage::Enc => Some("JsonWebEncryptionEnc"), Usage::Enc => Some("JsonWebEncryptionEnc"),
_ => None, Usage::Jwk => None,
} }
} }

View File

@@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#![forbid(unsafe_code)]
#![deny(clippy::all)]
#![deny(rustdoc::broken_intra_doc_links)]
#![warn(clippy::pedantic)]
use std::{collections::HashMap, fmt::Display, path::PathBuf, sync::Arc}; use std::{collections::HashMap, fmt::Display, path::PathBuf, sync::Arc};
use reqwest::Client; use reqwest::Client;
@@ -142,7 +147,7 @@ pub enum {} {{"#,
} }
} }
use self::{jose::*, oauth::*, traits::*}; use self::traits::{EnumEntry, EnumMember, Section};
#[tracing::instrument(skip(client))] #[tracing::instrument(skip(client))]
async fn generate_jose(client: &Arc<Client>, path: PathBuf) -> anyhow::Result<()> { async fn generate_jose(client: &Arc<Client>, path: PathBuf) -> anyhow::Result<()> {
@@ -154,17 +159,17 @@ async fn generate_jose(client: &Arc<Client>, path: PathBuf) -> anyhow::Result<()
"https://www.iana.org/assignments/jose/jose.xhtml", "https://www.iana.org/assignments/jose/jose.xhtml",
client.clone(), client.clone(),
) )
.load::<WebEncryptionSignatureAlgorithm>() .load::<jose::WebEncryptionSignatureAlgorithm>()
.await? .await?
.load::<WebEncryptionCompressionAlgorithm>() .load::<jose::WebEncryptionCompressionAlgorithm>()
.await? .await?
.load::<WebKeyType>() .load::<jose::WebKeyType>()
.await? .await?
.load::<WebKeyEllipticCurve>() .load::<jose::WebKeyEllipticCurve>()
.await? .await?
.load::<WebKeyUse>() .load::<jose::WebKeyUse>()
.await? .await?
.load::<WebKeyOperation>() .load::<jose::WebKeyOperation>()
.await?; .await?;
file.write(path).await?; file.write(path).await?;
@@ -182,15 +187,15 @@ async fn generate_oauth(client: &Arc<Client>, path: PathBuf) -> anyhow::Result<(
"https://www.iana.org/assignments/jose/jose.xhtml", "https://www.iana.org/assignments/jose/jose.xhtml",
client.clone(), client.clone(),
) )
.load::<AccessTokenType>() .load::<oauth::AccessTokenType>()
.await? .await?
.load::<AuthorizationEndpointResponseType>() .load::<oauth::AuthorizationEndpointResponseType>()
.await? .await?
.load::<TokenTypeHint>() .load::<oauth::TokenTypeHint>()
.await? .await?
.load::<TokenEndpointAuthenticationMethod>() .load::<oauth::TokenEndpointAuthenticationMethod>()
.await? .await?
.load::<PkceCodeChallengeMethod>() .load::<oauth::PkceCodeChallengeMethod>()
.await?; .await?;
file.write(path).await?; file.write(path).await?;

View File

@@ -25,6 +25,7 @@ pub struct Section {
pub url: Option<&'static str>, pub url: Option<&'static str>,
} }
#[must_use]
pub const fn s(key: &'static str, doc: &'static str) -> Section { pub const fn s(key: &'static str, doc: &'static str) -> Section {
Section { Section {
key, key,
@@ -45,6 +46,7 @@ pub trait EnumEntry: DeserializeOwned + Send + Sync {
const URL: &'static str; const URL: &'static str;
const SECTIONS: &'static [Section]; const SECTIONS: &'static [Section];
#[must_use]
fn sections() -> Vec<Section> { fn sections() -> Vec<Section> {
Self::SECTIONS Self::SECTIONS
.iter() .iter()

View File

@@ -12,5 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#![forbid(unsafe_code)]
#![deny(clippy::all)]
#![deny(rustdoc::broken_intra_doc_links)]
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
pub mod jose; pub mod jose;
pub mod oauth; pub mod oauth;