From 9c4bf00f794f3aaf19b523b7b5722dfac3071a28 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 2 Feb 2022 23:25:19 +0100 Subject: [PATCH] Remove remaining unstable-spec features Everything that was gated behind it was stabilized with Matrix v1.2. --- README.md | 10 +++------- crates/ruma-client-api/Cargo.toml | 1 - crates/ruma-client-api/src/r0/account.rs | 1 - crates/ruma-client-api/src/r0/uiaa.rs | 14 -------------- crates/ruma-client-api/tests/uiaa.rs | 2 -- crates/ruma/Cargo.toml | 6 ------ xtask/src/ci.rs | 4 ++-- 7 files changed, 5 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 8b4e453b..b931245e 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,10 @@ them. Check out the documentation [on docs.rs][docs] (or on ## Status As of 2022-01-31, we support all events and REST endpoints of the v1 version of -the Matrix specification, with v1.1 coverage in progress. +the Matrix specification, with v1.1 and v1.2 coverage in progress. -Various changes from the unreleased version of the specification are also -implemented, gated behind the `unstable-spec` Cargo feature. - -Various changes from in-progress MSCs, finished MSCs, -and (often) unreleased versions of the specification are also implemented, -gated behind the `unstable-pre-spec` Cargo feature. +Various changes from in-progress MSCs, finished MSCs, and a few less formalized +things are also implemented, gated behind the `unstable-pre-spec` Cargo feature. ## Contributing diff --git a/crates/ruma-client-api/Cargo.toml b/crates/ruma-client-api/Cargo.toml index af02a119..2b04c1bb 100644 --- a/crates/ruma-client-api/Cargo.toml +++ b/crates/ruma-client-api/Cargo.toml @@ -24,7 +24,6 @@ compat = [] unstable-exhaustive-types = [] # feature dependency required for r0::room::create_room::CreationContent::into_event_content unstable-pre-spec = ["ruma-events/unstable-pre-spec"] -unstable-spec = [] client = [] server = [] diff --git a/crates/ruma-client-api/src/r0/account.rs b/crates/ruma-client-api/src/r0/account.rs index 6f2c5440..1eee705b 100644 --- a/crates/ruma-client-api/src/r0/account.rs +++ b/crates/ruma-client-api/src/r0/account.rs @@ -3,7 +3,6 @@ pub mod add_3pid; pub mod bind_3pid; pub mod change_password; -#[cfg(feature = "unstable-spec")] // todo: v1.2 pub mod check_registration_token_validity; pub mod deactivate; pub mod delete_3pid; diff --git a/crates/ruma-client-api/src/r0/uiaa.rs b/crates/ruma-client-api/src/r0/uiaa.rs index ab9d3682..caca423a 100644 --- a/crates/ruma-client-api/src/r0/uiaa.rs +++ b/crates/ruma-client-api/src/r0/uiaa.rs @@ -59,7 +59,6 @@ pub enum AuthData<'a> { Dummy(Dummy<'a>), /// Registration token-based authentication (`m.login.registration_token`). - #[cfg(feature = "unstable-spec")] // todo: v1.2 RegistrationToken(RegistrationToken<'a>), /// Fallback acknowledgement. @@ -85,7 +84,6 @@ impl<'a> AuthData<'a> { Self::EmailIdentity(_) => Some(AuthType::EmailIdentity), Self::Msisdn(_) => Some(AuthType::Msisdn), Self::Dummy(_) => Some(AuthType::Dummy), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(_) => Some(AuthType::RegistrationToken), Self::FallbackAcknowledgement(_) => None, Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.into()))), @@ -102,7 +100,6 @@ impl<'a> AuthData<'a> { Self::EmailIdentity(x) => x.session, Self::Msisdn(x) => x.session, Self::Dummy(x) => x.session, - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(x) => x.session, Self::FallbackAcknowledgement(x) => Some(x.session), Self::_Custom(x) => x.session, @@ -145,7 +142,6 @@ impl<'a> AuthData<'a> { thirdparty_id_creds: x.thirdparty_id_creds, session: None, })), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(x) => { Cow::Owned(serialize(RegistrationToken { token: x.token, session: None })) } @@ -190,7 +186,6 @@ impl IncomingAuthData { "m.login.email.identity" => Self::EmailIdentity(deserialize_variant(session, data)?), "m.login.msisdn" => Self::Msisdn(deserialize_variant(session, data)?), "m.login.dummy" => Self::Dummy(deserialize_variant(session, data)?), - #[cfg(feature = "unstable-spec")] // todo: v1.2 "m.registration_token" => Self::RegistrationToken(deserialize_variant(session, data)?), _ => Self::_Custom(IncomingCustomAuthData { auth_type: auth_type.into(), @@ -210,7 +205,6 @@ impl IncomingAuthData { Self::EmailIdentity(_) => Some(AuthType::EmailIdentity), Self::Msisdn(_) => Some(AuthType::Msisdn), Self::Dummy(_) => Some(AuthType::Dummy), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(_) => Some(AuthType::RegistrationToken), Self::FallbackAcknowledgement(_) => None, Self::_Custom(c) => Some(AuthType::_Custom(PrivOwnedStr(c.auth_type.as_str().into()))), @@ -227,7 +221,6 @@ impl IncomingAuthData { Self::EmailIdentity(x) => x.session.as_deref(), Self::Msisdn(x) => x.session.as_deref(), Self::Dummy(x) => x.session.as_deref(), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(x) => x.session.as_deref(), Self::FallbackAcknowledgement(x) => Some(&x.session), Self::_Custom(x) => x.session.as_deref(), @@ -270,7 +263,6 @@ impl IncomingAuthData { thirdparty_id_creds: &x.thirdparty_id_creds, session: None, })), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(x) => { Cow::Owned(serialize(RegistrationToken { token: &x.token, session: None })) } @@ -290,7 +282,6 @@ impl IncomingAuthData { Self::EmailIdentity(a) => AuthData::EmailIdentity(a.to_outgoing()), Self::Msisdn(a) => AuthData::Msisdn(a.to_outgoing()), Self::Dummy(a) => AuthData::Dummy(a.to_outgoing()), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Self::RegistrationToken(a) => AuthData::RegistrationToken(a.to_outgoing()), Self::FallbackAcknowledgement(a) => AuthData::FallbackAcknowledgement(a.to_outgoing()), Self::_Custom(a) => AuthData::_Custom(CustomAuthData { @@ -327,7 +318,6 @@ impl<'de> Deserialize<'de> for IncomingAuthData { Some("m.login.email.identity") => from_raw_json_value(&json).map(Self::EmailIdentity), Some("m.login.msisdn") => from_raw_json_value(&json).map(Self::Msisdn), Some("m.login.dummy") => from_raw_json_value(&json).map(Self::Dummy), - #[cfg(feature = "unstable-spec")] // todo: v1.2 Some("m.login.registration_token") => { from_raw_json_value(&json).map(Self::RegistrationToken) } @@ -375,7 +365,6 @@ pub enum AuthType { /// Registration token-based authentication (`m.login.registration_token`). #[ruma_enum(rename = "m.login.registration_token")] - #[cfg(feature = "unstable-spec")] // todo: v1.2 RegistrationToken, #[doc(hidden)] @@ -606,7 +595,6 @@ impl IncomingDummy { #[derive(Clone, Debug, Outgoing, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[serde(tag = "type", rename = "m.login.registration_token")] -#[cfg(feature = "unstable-spec")] // todo: v1.2 pub struct RegistrationToken<'a> { /// The registration token. pub token: &'a str, @@ -615,7 +603,6 @@ pub struct RegistrationToken<'a> { pub session: Option<&'a str>, } -#[cfg(feature = "unstable-spec")] // todo: v1.2 impl<'a> RegistrationToken<'a> { /// Creates a new `RegistrationToken` with the given token. pub fn new(token: &'a str) -> Self { @@ -623,7 +610,6 @@ impl<'a> RegistrationToken<'a> { } } -#[cfg(feature = "unstable-spec")] // todo: v1.2 impl IncomingRegistrationToken { /// Convert from `IncomingRegistrationToken` to `RegistrationToken`. fn to_outgoing(&self) -> RegistrationToken<'_> { diff --git a/crates/ruma-client-api/tests/uiaa.rs b/crates/ruma-client-api/tests/uiaa.rs index 39f5e291..d660b7af 100644 --- a/crates/ruma-client-api/tests/uiaa.rs +++ b/crates/ruma-client-api/tests/uiaa.rs @@ -65,7 +65,6 @@ fn deserialize_auth_data_direct_request() { } #[test] -#[cfg(feature = "unstable-spec")] // todo: v1.2 fn serialize_auth_data_registration_token() { let auth_data = AuthData::RegistrationToken( assign!(uiaa::RegistrationToken::new("mytoken"), { session: Some("session") }), @@ -82,7 +81,6 @@ fn serialize_auth_data_registration_token() { } #[test] -#[cfg(feature = "unstable-spec")] // todo: v1.2 fn deserialize_auth_data_registration_token() { let json = json!({ "type": "m.login.registration_token", diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index 156ac12d..c5594a6d 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -115,12 +115,6 @@ unstable-pre-spec = [ "ruma-federation-api/unstable-pre-spec", "ruma-signatures/unstable-pre-spec", "ruma-state-res/__unstable-pre-spec", # for tests - # If you enable bleeding-edge pre-spec features, you - # probably want things from the unstable spec too - "unstable-spec", -] -unstable-spec = [ - "ruma-client-api/unstable-spec", ] [dependencies] diff --git a/xtask/src/ci.rs b/xtask/src/ci.rs index e971d582..767b0fc3 100644 --- a/xtask/src/ci.rs +++ b/xtask/src/ci.rs @@ -72,7 +72,7 @@ impl CiTask { // 2. Run tests let workspace_res = - cmd!("rustup run stable cargo test --workspace --features full,unstable-pre-spec,unstable-spec") + cmd!("rustup run stable cargo test --workspace --features full,unstable-pre-spec") .run(); let events_compat_res = cmd!("rustup run stable cargo test -p ruma-events --features compat compat").run(); @@ -98,7 +98,7 @@ impl CiTask { let clippy_all_res = cmd!( " rustup run nightly cargo clippy - --workspace --all-targets --features=full,compat,unstable-pre-spec,unstable-spec -- -D warnings + --workspace --all-targets --features=full,compat,unstable-pre-spec -- -D warnings " ) .run();