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 <public@benj.me>
This commit is contained in:
Benjamin Bouvier
2023-05-19 15:27:14 +02:00
parent ff1d784e70
commit da73229e8d
2 changed files with 5 additions and 3 deletions

View File

@@ -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`.

View File

@@ -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)
}
}