From 866b01d0c2d5d8cc1eb2fc34b70feb6a26676ba7 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 10 Nov 2022 10:45:10 +0100 Subject: [PATCH] api: Rename VersionHistory::added_version to added_in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … and reword its documentation. --- crates/ruma-common/src/api/metadata.rs | 10 +++++----- crates/ruma-common/tests/api/ui/01-api-sanity-check.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ruma-common/src/api/metadata.rs b/crates/ruma-common/src/api/metadata.rs index 9d4ba5f0..736a6b0e 100644 --- a/crates/ruma-common/src/api/metadata.rs +++ b/crates/ruma-common/src/api/metadata.rs @@ -364,7 +364,7 @@ impl VersionHistory { } // Check if *any* version marks this endpoint as stable. - if self.added_version().map_or(false, greater_or_equal_any) { + if self.added_in().map_or(false, greater_or_equal_any) { let all_deprecated = self.deprecated.map_or(false, greater_or_equal_all); return VersioningDecision::Stable { @@ -378,11 +378,11 @@ impl VersionHistory { VersioningDecision::Unstable } - /// Will return the *first* version this path was added in. + /// Returns the *first* version this endpoint was added in. /// - /// Is None when this endpoint is unstable/unreleased. - pub fn added_version(&self) -> Option { - self.stable_paths.first().map(|(x, _)| *x) + /// Is `None` when this endpoint is unstable/unreleased. + pub fn added_in(&self) -> Option { + self.stable_paths.first().map(|(v, _)| *v) } /// Picks the last unstable path, if it exists. diff --git a/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs b/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs index 366c553b..6e0cc2d6 100644 --- a/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs +++ b/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs @@ -73,7 +73,7 @@ fn main() { ] ); - assert_eq!(METADATA.history.added_version(), Some(MatrixVersion::V1_0)); + assert_eq!(METADATA.history.added_in(), Some(MatrixVersion::V1_0)); assert_eq!(METADATA.history.deprecated, Some(MatrixVersion::V1_2)); assert_eq!(METADATA.history.removed, Some(MatrixVersion::V1_3)); }