From da73229e8ddbb6551daf20e763bbbcd45eaf0368 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Fri, 19 May 2023 15:27:14 +0200 Subject: [PATCH] chore(comment): fix the comment for `Error::CannotModifyRanges` The comment and the check in the code were contradicting each other; the comment was wrong, and the code was right, so there's that. Signed-off-by: Benjamin Bouvier --- crates/matrix-sdk/src/sliding_sync/error.rs | 6 +++--- crates/matrix-sdk/src/sliding_sync/list/mod.rs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/matrix-sdk/src/sliding_sync/error.rs b/crates/matrix-sdk/src/sliding_sync/error.rs index 58053dc52..6d2b5aa7c 100644 --- a/crates/matrix-sdk/src/sliding_sync/error.rs +++ b/crates/matrix-sdk/src/sliding_sync/error.rs @@ -19,9 +19,9 @@ pub enum Error { #[error("The sliding sync list `{0}` is handling a response, but its request generator has not been initialized")] RequestGeneratorHasNotBeenInitialized(String), - /// Someone has tried to modify a sliding sync list's ranges, but the - /// selected sync mode doesn't allow that. - #[error("The chosen sync mode for the list `{0}` doesn't allow to modify the ranges")] + /// Someone has tried to modify a sliding sync list's ranges, but only the + /// `Selective` sync mode does allow that. + #[error("The chosen sync mode for the list `{0}` doesn't allow to modify the ranges; only `Selective` allows that")] CannotModifyRanges(String), /// Ranges have a `start` bound greater than `end`. diff --git a/crates/matrix-sdk/src/sliding_sync/list/mod.rs b/crates/matrix-sdk/src/sliding_sync/list/mod.rs index bd3364579..38d0236e3 100644 --- a/crates/matrix-sdk/src/sliding_sync/list/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/list/mod.rs @@ -912,6 +912,8 @@ pub enum SlidingSyncMode { impl SlidingSyncMode { /// Return whether an external caller can modify the sync mode's ranges. fn ranges_can_be_modified_by_user(&self) -> bool { + // If this gets modified, don't forget to update the `Error::CannotModifyRanges` + // error message. matches!(self, Self::Selective) } }