diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d942fc58..19633e52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ env: CARGO_TERM_COLOR: always CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse # Keep in sync with version in `rust-toolchain.toml` and `xtask/src/ci.rs` - NIGHTLY: nightly-2024-07-29 + NIGHTLY: nightly-2024-09-06 on: push: diff --git a/crates/ruma-common/src/serde/raw.rs b/crates/ruma-common/src/serde/raw.rs index 30b9cfda..7be90ffb 100644 --- a/crates/ruma-common/src/serde/raw.rs +++ b/crates/ruma-common/src/serde/raw.rs @@ -11,9 +11,7 @@ use serde::{ }; use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue}; -/// A wrapper around `Box`, to be used in place of any type in the Matrix endpoint -/// definition to allow request and response types to contain that said type represented by -/// the generic argument `Ev`. +/// A wrapper around `Box` with a generic parameter for the expected Rust type. /// /// Ruma offers the `Raw` wrapper to enable passing around JSON text that is only partially /// validated. This is useful when a client receives events that do not follow the spec perfectly diff --git a/crates/ruma-common/src/serde/strings.rs b/crates/ruma-common/src/serde/strings.rs index 55d94e47..dcb3cef9 100644 --- a/crates/ruma-common/src/serde/strings.rs +++ b/crates/ruma-common/src/serde/strings.rs @@ -9,6 +9,7 @@ use serde::{ /// Serde deserialization decorator to map empty Strings to None, /// and forward non-empty Strings to the Deserialize implementation for T. +/// /// Useful for the typical /// "A room with an X event with an absent, null, or empty Y field /// should be treated the same as a room with no such event." diff --git a/crates/ruma-common/tests/api/ui/move-value.rs b/crates/ruma-common/tests/api/ui/move-value.rs index f6e5af69..70f82b38 100644 --- a/crates/ruma-common/tests/api/ui/move-value.rs +++ b/crates/ruma-common/tests/api/ui/move-value.rs @@ -1,7 +1,7 @@ // This tests that the "body" fields are moved after all other fields because they // consume the request/response. -mod newtype_body { +pub mod newtype_body { use http::header::CONTENT_TYPE; use ruma_common::{ api::{request, response, Metadata}, @@ -47,7 +47,7 @@ mod newtype_body { } } -mod raw_body { +pub mod raw_body { use http::header::CONTENT_TYPE; use ruma_common::{ api::{request, response, Metadata}, @@ -90,7 +90,7 @@ mod raw_body { } } -mod plain { +pub mod plain { use http::header::CONTENT_TYPE; use ruma_common::{ api::{request, response, Metadata}, diff --git a/crates/ruma-events/src/call/member.rs b/crates/ruma-events/src/call/member.rs index 03c35dff..faa8f6f5 100644 --- a/crates/ruma-events/src/call/member.rs +++ b/crates/ruma-events/src/call/member.rs @@ -147,7 +147,9 @@ pub struct EmptyMembershipData { } /// This is the optional value for an empty membership event content: -/// [`CallMemberEventContent::Empty`]. It is used when the user disconnected and a Future ([MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140)) +/// [`CallMemberEventContent::Empty`]. +/// +/// It is used when the user disconnected and a Future ([MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140)) /// was used to update the membership after the client was not reachable anymore. #[derive(Clone, PartialEq, StringEnum)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] diff --git a/crates/ruma-events/tests/it/ui/13-private-event-content-type.rs b/crates/ruma-events/tests/it/ui/13-private-event-content-type.rs index d0dc7af5..e57241f9 100644 --- a/crates/ruma-events/tests/it/ui/13-private-event-content-type.rs +++ b/crates/ruma-events/tests/it/ui/13-private-event-content-type.rs @@ -1,4 +1,5 @@ -#![deny(private_in_public)] +#![deny(private_interfaces, private_bounds, unnameable_types)] +#![allow(dead_code)] use ruma_macros::EventContent; use serde::{Deserialize, Serialize}; diff --git a/crates/ruma-federation-api/src/membership/create_join_event.rs b/crates/ruma-federation-api/src/membership/create_join_event.rs index 78406535..1a1e9639 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event.rs @@ -2,6 +2,5 @@ //! //! Send a join event to a resident server. -#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub mod v1; pub mod v2; diff --git a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs index f21e9212..976aa24b 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event/v1.rs @@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! { /// Request type for the `create_join_event` endpoint. #[request] +#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub struct Request { /// The room ID that is about to be joined. /// @@ -39,6 +40,7 @@ pub struct Request { /// Response type for the `create_join_event` endpoint. #[response] +#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub struct Response { /// Full state and auth chain of the room prior to the join event. #[ruma_api(body)] @@ -46,6 +48,7 @@ pub struct Response { pub room_state: RoomState, } +#[allow(deprecated)] impl Request { /// Creates a new `Request` from the given room ID, event ID and PDU. pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box) -> Self { @@ -53,6 +56,7 @@ impl Request { } } +#[allow(deprecated)] impl Response { /// Creates a new `Response` with the given room state. pub fn new(room_state: RoomState) -> Self { diff --git a/crates/ruma-federation-api/src/membership/create_leave_event.rs b/crates/ruma-federation-api/src/membership/create_leave_event.rs index a502007e..4f840b44 100644 --- a/crates/ruma-federation-api/src/membership/create_leave_event.rs +++ b/crates/ruma-federation-api/src/membership/create_leave_event.rs @@ -2,6 +2,5 @@ //! //! Submit a signed leave event to the receiving server for it to accept it into the room's graph. -#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub mod v1; pub mod v2; diff --git a/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs b/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs index 239a982d..6fb65917 100644 --- a/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs @@ -21,6 +21,7 @@ const METADATA: Metadata = metadata! { /// Request type for the `create_leave_event` endpoint. #[request] +#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub struct Request { /// The room ID that is about to be left. /// @@ -40,6 +41,7 @@ pub struct Request { /// Response type for the `create_leave_event` endpoint. #[response] #[derive(Default)] +#[deprecated = "Since Matrix Server-Server API r0.1.4. Use the v2 endpoint instead."] pub struct Response { /// An empty object. /// @@ -49,6 +51,7 @@ pub struct Response { pub empty: Empty, } +#[allow(deprecated)] impl Request { /// Creates a new `Request` from the given room ID, event ID and PDU. pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, pdu: Box) -> Self { @@ -56,6 +59,7 @@ impl Request { } } +#[allow(deprecated)] impl Response { /// Creates an empty `Response`. pub fn new() -> Self { diff --git a/crates/ruma-macros/src/api/request.rs b/crates/ruma-macros/src/api/request.rs index 386f3ecd..4081101a 100644 --- a/crates/ruma-macros/src/api/request.rs +++ b/crates/ruma-macros/src/api/request.rs @@ -101,7 +101,7 @@ pub fn expand_derive_request(input: ItemStruct) -> syn::Result { #types_impls #[allow(deprecated)] - #[cfg(tests)] + #[cfg(test)] mod __request { #test } @@ -272,9 +272,8 @@ impl Request { let path_fields = self.path_fields().map(|f| f.ident.as_ref().unwrap().to_string()); let mut tests = quote! { #[::std::prelude::v1::test] - #[allow(deprecated)] fn path_parameters() { - let path_params = METADATA._path_parameters(); + let path_params = super::METADATA._path_parameters(); let request_path_fields: &[&::std::primitive::str] = &[#(#path_fields),*]; ::std::assert_eq!( path_params, request_path_fields, @@ -288,7 +287,7 @@ impl Request { #[::std::prelude::v1::test] fn request_is_not_get() { ::std::assert_ne!( - METADATA.method, #http::Method::GET, + super::METADATA.method, #http::Method::GET, "GET endpoints can't have body fields", ); } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a2ab784c..b32b8c45 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] # Keep in sync with version in `xtask/src/ci.rs` and `.github/workflows/ci.yml` -channel = "nightly-2024-07-29" +channel = "nightly-2024-09-06" components = ["rustfmt", "clippy"] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 057bc5e4..5c18a59b 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -15,7 +15,7 @@ use serde::Deserialize; use serde_json::from_str as from_json_str; // Keep in sync with version in `rust-toolchain.toml` and `.github/workflows/ci.yml` -const NIGHTLY: &str = "nightly-2024-07-29"; +const NIGHTLY: &str = "nightly-2024-09-06"; mod cargo; mod ci;