mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-25 22:48:34 +00:00
resolve wildcard_imports and checked_conversations lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
f0a0704a93
commit
1b84f5a855
|
@ -527,6 +527,8 @@ explicit_deref_methods = "warn"
|
|||
explicit_iter_loop = "warn"
|
||||
manual_let_else = "warn"
|
||||
trivially_copy_pass_by_ref = "warn"
|
||||
wildcard_imports = "warn"
|
||||
checked_conversions = "warn"
|
||||
|
||||
# some sadness
|
||||
missing_errors_doc = "allow"
|
||||
|
|
|
@ -8,7 +8,7 @@ use axum::{
|
|||
};
|
||||
use conduit::{
|
||||
api::{client_server, server_server},
|
||||
*,
|
||||
Error, Result, Ruma, RumaResponse,
|
||||
};
|
||||
use http::{Method, Uri};
|
||||
use ruma::api::{client::error::ErrorKind, IncomingRequest};
|
||||
|
|
|
@ -394,12 +394,12 @@ impl Service {
|
|||
u64::from(original_width) * u64::from(height) / u64::from(original_height)
|
||||
};
|
||||
if use_width {
|
||||
if intermediate <= u64::from(u32::MAX) {
|
||||
if u32::try_from(intermediate).is_ok() {
|
||||
(width, intermediate as u32)
|
||||
} else {
|
||||
((u64::from(width) * u64::from(u32::MAX) / intermediate) as u32, u32::MAX)
|
||||
}
|
||||
} else if intermediate <= u64::from(u32::MAX) {
|
||||
} else if u32::try_from(intermediate).is_ok() {
|
||||
(intermediate as u32, height)
|
||||
} else {
|
||||
(u32::MAX, (u64::from(height) * u64::from(u32::MAX) / intermediate) as u32)
|
||||
|
|
|
@ -110,6 +110,8 @@ impl Service {
|
|||
/// Pings the presence of the given user in the given room, setting the
|
||||
/// specified state.
|
||||
pub fn ping_presence(&self, user_id: &UserId, new_state: &PresenceState) -> Result<()> {
|
||||
const REFRESH_TIMEOUT: u64 = 60 * 25 * 1000;
|
||||
|
||||
let last_presence = self.db.get_presence(user_id)?;
|
||||
let state_changed = match last_presence {
|
||||
None => true,
|
||||
|
@ -121,7 +123,6 @@ impl Service {
|
|||
Some((_, ref presence)) => presence.content.last_active_ago.unwrap_or_default().into(),
|
||||
};
|
||||
|
||||
const REFRESH_TIMEOUT: u64 = 60 * 25 * 1000;
|
||||
if !state_changed && last_last_active_ago < REFRESH_TIMEOUT {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue