resolve almost all as_conversions lints
may need further opinion from others on these Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
f8e1255994
commit
0ebb323490
18 changed files with 144 additions and 85 deletions
|
@ -30,6 +30,7 @@ pub(crate) struct Hooked {
|
|||
}
|
||||
|
||||
impl Resolver {
|
||||
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
|
||||
pub(crate) fn new(config: &Config) -> Self {
|
||||
let (sys_conf, mut opts) = hickory_resolver::system_conf::read_system_conf()
|
||||
.map_err(|e| {
|
||||
|
|
|
@ -40,6 +40,7 @@ pub(crate) struct Services<'a> {
|
|||
}
|
||||
|
||||
impl Services<'_> {
|
||||
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
|
||||
pub(crate) fn build<
|
||||
D: appservice::Data
|
||||
+ pusher::Data
|
||||
|
|
|
@ -188,13 +188,14 @@ impl Service {
|
|||
|
||||
let ctx = PushConditionRoomCtx {
|
||||
room_id: room_id.to_owned(),
|
||||
member_count: UInt::from(
|
||||
member_count: UInt::try_from(
|
||||
services()
|
||||
.rooms
|
||||
.state_cache
|
||||
.room_joined_count(room_id)?
|
||||
.unwrap_or(1) as u32,
|
||||
),
|
||||
.unwrap_or(1),
|
||||
)
|
||||
.unwrap_or_else(|_| uint!(0)),
|
||||
user_id: user.to_owned(),
|
||||
user_display_name: services()
|
||||
.users
|
||||
|
|
|
@ -5,7 +5,7 @@ pub(crate) use data::Data;
|
|||
use ruma::{
|
||||
api::{client::relations::get_relating_events, Direction},
|
||||
events::{relation::RelationType, TimelineEventType},
|
||||
EventId, RoomId, UInt, UserId,
|
||||
uint, EventId, RoomId, UInt, UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
|
@ -57,8 +57,9 @@ impl Service {
|
|||
|
||||
// Use limit or else 10, with maximum 100
|
||||
let limit = limit
|
||||
.and_then(|u| u32::try_from(u).ok())
|
||||
.map_or(10_usize, |u| u as usize)
|
||||
.unwrap_or_else(|| uint!(10))
|
||||
.try_into()
|
||||
.unwrap_or(10)
|
||||
.min(100);
|
||||
|
||||
let next_token;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue