mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
enable same_name_method lint
This commit is contained in:
parent
d144db8688
commit
cc5977b4e4
6 changed files with 14 additions and 17 deletions
|
|
@ -47,6 +47,7 @@ redundant_feature_names = "warn"
|
||||||
redundant_type_annotations = "warn"
|
redundant_type_annotations = "warn"
|
||||||
ref_patterns = "warn"
|
ref_patterns = "warn"
|
||||||
rest_pat_in_fully_bound_structs = "warn"
|
rest_pat_in_fully_bound_structs = "warn"
|
||||||
|
same_name_method = "warn"
|
||||||
semicolon_inside_block = "warn"
|
semicolon_inside_block = "warn"
|
||||||
str_to_string = "warn"
|
str_to_string = "warn"
|
||||||
string_lit_chars_any = "warn"
|
string_lit_chars_any = "warn"
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,8 @@ pub(crate) async fn get_message_events_route(
|
||||||
let from = match body.from.clone() {
|
let from = match body.from.clone() {
|
||||||
Some(from) => PduCount::try_from_string(&from)?,
|
Some(from) => PduCount::try_from_string(&from)?,
|
||||||
None => match body.dir {
|
None => match body.dir {
|
||||||
ruma::api::Direction::Forward => PduCount::min(),
|
ruma::api::Direction::Forward => PduCount::MIN,
|
||||||
ruma::api::Direction::Backward => PduCount::max(),
|
ruma::api::Direction::Backward => PduCount::MAX,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
|
||||||
Some(from) => PduCount::try_from_string(&from)?,
|
Some(from) => PduCount::try_from_string(&from)?,
|
||||||
None => match ruma::api::Direction::Backward {
|
None => match ruma::api::Direction::Backward {
|
||||||
// TODO: fix ruma so `body.dir` exists
|
// TODO: fix ruma so `body.dir` exists
|
||||||
ruma::api::Direction::Forward => PduCount::min(),
|
ruma::api::Direction::Forward => PduCount::MIN,
|
||||||
ruma::api::Direction::Backward => PduCount::max(),
|
ruma::api::Direction::Backward => PduCount::MAX,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -69,8 +69,8 @@ pub(crate) async fn get_relating_events_with_rel_type_route(
|
||||||
Some(from) => PduCount::try_from_string(&from)?,
|
Some(from) => PduCount::try_from_string(&from)?,
|
||||||
None => match ruma::api::Direction::Backward {
|
None => match ruma::api::Direction::Backward {
|
||||||
// TODO: fix ruma so `body.dir` exists
|
// TODO: fix ruma so `body.dir` exists
|
||||||
ruma::api::Direction::Forward => PduCount::min(),
|
ruma::api::Direction::Forward => PduCount::MIN,
|
||||||
ruma::api::Direction::Backward => PduCount::max(),
|
ruma::api::Direction::Backward => PduCount::MAX,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -118,8 +118,8 @@ pub(crate) async fn get_relating_events_route(
|
||||||
Some(from) => PduCount::try_from_string(&from)?,
|
Some(from) => PduCount::try_from_string(&from)?,
|
||||||
None => match ruma::api::Direction::Backward {
|
None => match ruma::api::Direction::Backward {
|
||||||
// TODO: fix ruma so `body.dir` exists
|
// TODO: fix ruma so `body.dir` exists
|
||||||
ruma::api::Direction::Forward => PduCount::min(),
|
ruma::api::Direction::Forward => PduCount::MIN,
|
||||||
ruma::api::Direction::Backward => PduCount::max(),
|
ruma::api::Direction::Backward => PduCount::MAX,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1120,7 +1120,7 @@ fn load_timeline(
|
||||||
let mut non_timeline_pdus = services()
|
let mut non_timeline_pdus = services()
|
||||||
.rooms
|
.rooms
|
||||||
.timeline
|
.timeline
|
||||||
.pdus_until(sender_user, room_id, PduCount::max())?
|
.pdus_until(sender_user, room_id, PduCount::MAX)?
|
||||||
.filter_map(|r| {
|
.filter_map(|r| {
|
||||||
// Filter out buggy events
|
// Filter out buggy events
|
||||||
if r.is_err() {
|
if r.is_err() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ impl service::rooms::timeline::Data for KeyValueDatabase {
|
||||||
{
|
{
|
||||||
hash_map::Entry::Vacant(v) => {
|
hash_map::Entry::Vacant(v) => {
|
||||||
if let Some(last_count) = self
|
if let Some(last_count) = self
|
||||||
.pdus_until(sender_user, room_id, PduCount::max())?
|
.pdus_until(sender_user, room_id, PduCount::MAX)?
|
||||||
.find_map(|r| {
|
.find_map(|r| {
|
||||||
// Filter out buggy events
|
// Filter out buggy events
|
||||||
if r.is_err() {
|
if r.is_err() {
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,8 @@ pub(crate) enum PduCount {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PduCount {
|
impl PduCount {
|
||||||
pub(crate) fn min() -> Self {
|
pub(crate) const MIN: Self = Self::Backfilled(u64::MAX);
|
||||||
Self::Backfilled(u64::MAX)
|
pub(crate) const MAX: Self = Self::Normal(u64::MAX);
|
||||||
}
|
|
||||||
pub(crate) fn max() -> Self {
|
|
||||||
Self::Normal(u64::MAX)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn try_from_string(token: &str) -> Result<Self> {
|
pub(crate) fn try_from_string(token: &str) -> Result<Self> {
|
||||||
if let Some(stripped) = token.strip_prefix('-') {
|
if let Some(stripped) = token.strip_prefix('-') {
|
||||||
|
|
@ -1052,7 +1048,7 @@ impl Service {
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
) -> Result<impl Iterator<Item = Result<(PduCount, PduEvent)>> + 'a> {
|
) -> Result<impl Iterator<Item = Result<(PduCount, PduEvent)>> + 'a> {
|
||||||
self.pdus_after(user_id, room_id, PduCount::min())
|
self.pdus_after(user_id, room_id, PduCount::MIN)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator over all events and their tokens in a room that happened before the
|
/// Returns an iterator over all events and their tokens in a room that happened before the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue