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