diff --git a/crates/ruma-client-api/src/r0/directory.rs b/crates/ruma-client-api/src/r0/directory.rs index eac62471..a7e3621f 100644 --- a/crates/ruma-client-api/src/r0/directory.rs +++ b/crates/ruma-client-api/src/r0/directory.rs @@ -56,7 +56,7 @@ pub struct PublicRoomsChunk { } impl PublicRoomsChunk { - /// Creates a `PublicRoomsChunk` with the given room ID. + /// Creates a new `PublicRoomsChunk` with the given room ID. /// /// All other fields will be propagated with default values (an empty list of aliases, `None` /// for all `Option`al fields and `false` for all boolean fields), which should be overriden; diff --git a/crates/ruma-client-api/src/r0/filter.rs b/crates/ruma-client-api/src/r0/filter.rs index f2923077..585d8452 100644 --- a/crates/ruma-client-api/src/r0/filter.rs +++ b/crates/ruma-client-api/src/r0/filter.rs @@ -107,7 +107,7 @@ impl<'a> RoomEventFilter<'a> { Self::default() } - /// Creates a `RoomEventFilter` that can be used to ignore all room events. + /// Creates a new `RoomEventFilter` that can be used to ignore all room events. pub fn ignore_all() -> Self { Self { types: Some(&[]), ..Default::default() } } @@ -193,7 +193,7 @@ impl<'a> RoomFilter<'a> { Self::default() } - /// Creates a `RoomFilter` that can be used to ignore all room events (of any type). + /// Creates a new `RoomFilter` that can be used to ignore all room events (of any type). pub fn ignore_all() -> Self { Self { rooms: Some(&[]), ..Default::default() } } @@ -269,7 +269,7 @@ impl<'a> Filter<'a> { Self::default() } - /// Creates a `Filter` that can be used to ignore all events. + /// Creates a new `Filter` that can be used to ignore all events. pub fn ignore_all() -> Self { Self { types: Some(&[]), ..Default::default() } } @@ -337,7 +337,7 @@ impl<'a> FilterDefinition<'a> { Self::default() } - /// Creates a `FilterDefinition` that can be used to ignore all events. + /// Creates a new `FilterDefinition` that can be used to ignore all events. pub fn ignore_all() -> Self { Self { account_data: Filter::ignore_all(), diff --git a/crates/ruma-client-api/src/r0/room/create_room.rs b/crates/ruma-client-api/src/r0/room/create_room.rs index 312af5f4..57adaf85 100644 --- a/crates/ruma-client-api/src/r0/room/create_room.rs +++ b/crates/ruma-client-api/src/r0/room/create_room.rs @@ -96,14 +96,14 @@ ruma_api! { } impl Request<'_> { - /// Creates a `Request` will all-default parameters. + /// Creates a new `Request` will all-default parameters. pub fn new() -> Self { Default::default() } } impl Response { - /// Creates a `Response` with the given room id. + /// Creates a new `Response` with the given room id. pub fn new(room_id: RoomId) -> Self { Self { room_id } } diff --git a/crates/ruma-client-api/src/r0/session/get_login_types.rs b/crates/ruma-client-api/src/r0/session/get_login_types.rs index 93ff39e7..1a9e3b14 100644 --- a/crates/ruma-client-api/src/r0/session/get_login_types.rs +++ b/crates/ruma-client-api/src/r0/session/get_login_types.rs @@ -67,7 +67,7 @@ pub enum LoginType { } impl LoginType { - /// Creates a `LoginType` with the given `login_type` string and data. + /// Creates a new `LoginType` with the given `login_type` string and data. /// /// Prefer to use the public variants of `LoginType` where possible; this constructor is meant /// be used for unsupported login types only and does not allow setting arbitrary data for diff --git a/crates/ruma-client-api/src/r0/sync/sync_events.rs b/crates/ruma-client-api/src/r0/sync/sync_events.rs index 891b9d4f..4228154b 100644 --- a/crates/ruma-client-api/src/r0/sync/sync_events.rs +++ b/crates/ruma-client-api/src/r0/sync/sync_events.rs @@ -111,7 +111,7 @@ impl Request<'_> { } impl Response { - /// Creates a `Response` with the given batch token. + /// Creates a new `Response` with the given batch token. pub fn new(next_batch: String) -> Self { Self { next_batch, diff --git a/crates/ruma-client-api/src/unversioned/discover_homeserver.rs b/crates/ruma-client-api/src/unversioned/discover_homeserver.rs index 77fe8151..181fb744 100644 --- a/crates/ruma-client-api/src/unversioned/discover_homeserver.rs +++ b/crates/ruma-client-api/src/unversioned/discover_homeserver.rs @@ -37,7 +37,7 @@ impl Request { } impl Response { - /// Creates a `Response` with the given `HomeserverInfo`. + /// Creates a new `Response` with the given `HomeserverInfo`. pub fn new(homeserver: HomeserverInfo) -> Self { Self { homeserver, identity_server: None } } @@ -52,7 +52,7 @@ pub struct HomeserverInfo { } impl HomeserverInfo { - /// Creates a `HomeserverInfo` with the given `base_url`. + /// Creates a new `HomeserverInfo` with the given `base_url`. pub fn new(base_url: String) -> Self { Self { base_url } } diff --git a/crates/ruma-client-api/src/unversioned/get_supported_versions.rs b/crates/ruma-client-api/src/unversioned/get_supported_versions.rs index 69fc6d56..c8cbab68 100644 --- a/crates/ruma-client-api/src/unversioned/get_supported_versions.rs +++ b/crates/ruma-client-api/src/unversioned/get_supported_versions.rs @@ -37,7 +37,7 @@ impl Request { } impl Response { - /// Creates a `Response` with the given `versions`. + /// Creates a new `Response` with the given `versions`. pub fn new(versions: Vec) -> Self { Self { versions, unstable_features: BTreeMap::new() } } diff --git a/crates/ruma-common/src/time.rs b/crates/ruma-common/src/time.rs index d5443b4e..ff0ed153 100644 --- a/crates/ruma-common/src/time.rs +++ b/crates/ruma-common/src/time.rs @@ -11,8 +11,8 @@ use std::{ pub struct MilliSecondsSinceUnixEpoch(pub UInt); impl MilliSecondsSinceUnixEpoch { - /// Creates a `MilliSecondsSinceUnixEpoch` from the given `SystemTime`, if it is not before the - /// unix epoch, or too large to be represented. + /// Creates a new `MilliSecondsSinceUnixEpoch` from the given `SystemTime`, if it is not before + /// the unix epoch, or too large to be represented. pub fn from_system_time(time: SystemTime) -> Option { let duration = time.duration_since(UNIX_EPOCH).ok()?; let millis = duration.as_millis().try_into().ok()?; @@ -24,7 +24,7 @@ impl MilliSecondsSinceUnixEpoch { Self::from_system_time(SystemTime::now()).unwrap() } - /// Creates a `SystemTime` from `self`, if it can be represented. + /// Creates a new `SystemTime` from `self`, if it can be represented. pub fn to_system_time(self) -> Option { UNIX_EPOCH.checked_add(Duration::from_millis(self.0.into())) } @@ -36,15 +36,15 @@ impl MilliSecondsSinceUnixEpoch { pub struct SecondsSinceUnixEpoch(pub UInt); impl SecondsSinceUnixEpoch { - /// Creates a `MilliSecondsSinceUnixEpoch` from the given `SystemTime`, if it is not before the - /// unix epoch, or too large to be represented. + /// Creates a new `MilliSecondsSinceUnixEpoch` from the given `SystemTime`, if it is not before + /// the unix epoch, or too large to be represented. pub fn from_system_time(time: SystemTime) -> Option { let duration = time.duration_since(UNIX_EPOCH).ok()?; let millis = duration.as_secs().try_into().ok()?; Some(Self(millis)) } - /// Creates a `SystemTime` from `self`, if it can be represented. + /// Creates a new `SystemTime` from `self`, if it can be represented. pub fn to_system_time(self) -> Option { UNIX_EPOCH.checked_add(Duration::from_secs(self.0.into())) } diff --git a/crates/ruma-events/src/key/verification/start.rs b/crates/ruma-events/src/key/verification/start.rs index cbb6f366..f64ae354 100644 --- a/crates/ruma-events/src/key/verification/start.rs +++ b/crates/ruma-events/src/key/verification/start.rs @@ -535,7 +535,7 @@ mod tests { #[test] fn deserialization_failure() { - // Ensure that invalid JSON creates a `serde_json::Error` and not `InvalidEvent` + // Ensure that invalid JSON Creates a new `serde_json::Error` and not `InvalidEvent` assert!(serde_json::from_str::>("{").is_err()); } diff --git a/crates/ruma-events/src/room/message.rs b/crates/ruma-events/src/room/message.rs index dee6f5cd..bd3f822b 100644 --- a/crates/ruma-events/src/room/message.rs +++ b/crates/ruma-events/src/room/message.rs @@ -197,7 +197,7 @@ pub enum MessageType { } impl MessageType { - /// Creates a `MessageType` with the given `msgtype` string and data. + /// Creates a new `MessageType` with the given `msgtype` string and data. /// /// Prefer to use the public variants of `MessageType` where possible; this constructor is meant /// be used for unsupported message types only and does not allow setting arbitrary data for diff --git a/crates/ruma-events/src/room/power_levels.rs b/crates/ruma-events/src/room/power_levels.rs index 952e14cb..0f38093b 100644 --- a/crates/ruma-events/src/room/power_levels.rs +++ b/crates/ruma-events/src/room/power_levels.rs @@ -118,7 +118,7 @@ pub struct PowerLevelsEventContent { } impl PowerLevelsEventContent { - /// Creates a `PowerLevelsEventContent` with all-default values. + /// Creates a new `PowerLevelsEventContent` with all-default values. pub fn new() -> Self { // events_default and users_default having a default of 0 while the others have a default // of 50 is not an oversight, these defaults are from the Matrix specification. diff --git a/crates/ruma-events/src/room/redaction.rs b/crates/ruma-events/src/room/redaction.rs index d15f9beb..d2b23234 100644 --- a/crates/ruma-events/src/room/redaction.rs +++ b/crates/ruma-events/src/room/redaction.rs @@ -70,7 +70,7 @@ impl RedactionEventContent { Self::default() } - /// Creates a `RedactionEventContent` with the given reason. + /// Creates a new `RedactionEventContent` with the given reason. pub fn with_reason(reason: String) -> Self { Self { reason: Some(reason) } } 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 17e43bbd..41b91b7c 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 @@ -42,7 +42,7 @@ ruma_api! { } impl<'a> Request<'a> { - /// Creates a `Request` from the given room ID, event ID and `Pdu`. + /// Creates a new `Request` from the given room ID, event ID and `Pdu`. pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Raw) -> Self { Self { room_id, event_id, pdu } } diff --git a/crates/ruma-federation-api/src/membership/create_join_event/v2.rs b/crates/ruma-federation-api/src/membership/create_join_event/v2.rs index b9876972..29777fe2 100644 --- a/crates/ruma-federation-api/src/membership/create_join_event/v2.rs +++ b/crates/ruma-federation-api/src/membership/create_join_event/v2.rs @@ -41,7 +41,7 @@ ruma_api! { } impl<'a> Request<'a> { - /// Creates a `Request` from the given room ID, event ID and `Pdu`. + /// Creates a new `Request` from the given room ID, event ID and `Pdu`. pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Raw) -> Self { Self { room_id, event_id, pdu } } diff --git a/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs b/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs index 8052cd84..13dd5dda 100644 --- a/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs +++ b/crates/ruma-federation-api/src/membership/create_leave_event/v2.rs @@ -36,7 +36,7 @@ ruma_api! { } impl<'a> Request<'a> { - /// Creates a `Request` from the given room ID, event ID and `Pdu`. + /// Creates a new `Request` from the given room ID, event ID and `Pdu`. pub fn new(room_id: &'a RoomId, event_id: &'a EventId, pdu: Raw) -> Self { Self { room_id, event_id, pdu } } diff --git a/crates/ruma-identifiers/src/key_id.rs b/crates/ruma-identifiers/src/key_id.rs index f16aa4fb..b7d66df0 100644 --- a/crates/ruma-identifiers/src/key_id.rs +++ b/crates/ruma-identifiers/src/key_id.rs @@ -18,7 +18,7 @@ pub struct KeyId { } impl KeyId { - /// Creates a `KeyId` from an algorithm and key name. + /// Creates a new `KeyId` from an algorithm and key name. pub fn from_parts(algorithm: A, key_name: &K) -> Self where A: AsRef, diff --git a/crates/ruma-identity-service-api/src/authentication/register/v2.rs b/crates/ruma-identity-service-api/src/authentication/register/v2.rs index 6c6be5c1..d49f4040 100644 --- a/crates/ruma-identity-service-api/src/authentication/register/v2.rs +++ b/crates/ruma-identity-service-api/src/authentication/register/v2.rs @@ -40,7 +40,7 @@ ruma_api! { } impl<'a> Request<'a> { - /// Creates a `Request` with the given parameters. + /// Creates a new `Request` with the given parameters. pub fn new( access_token: &'a str, token_type: TokenType,