slight adjustments, remove some explicit annotations

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-04 23:15:18 -04:00 committed by June
parent 9cc4f3e929
commit f0a0704a93
8 changed files with 14 additions and 21 deletions

View file

@ -1,4 +1,3 @@
// not unix specific, just only for UNIX sockets stuff and *nix container checks
#[cfg(unix)] #[cfg(unix)]
use std::path::Path; // not unix specific, just only for UNIX sockets stuff and *nix container checks use std::path::Path; // not unix specific, just only for UNIX sockets stuff and *nix container checks

View file

@ -45,7 +45,7 @@ pub(crate) trait KvTree: Send + Sync {
#[cfg(feature = "rocksdb")] #[cfg(feature = "rocksdb")]
fn multi_get( fn multi_get(
&self, _iter: Vec<(&Arc<rust_rocksdb::BoundColumnFamily<'_>>, Vec<u8>)>, &self, _iter: Vec<(&Arc<rust_rocksdb::BoundColumnFamily<'_>>, Vec<u8>)>,
) -> Vec<std::result::Result<Option<Vec<u8>>, rust_rocksdb::Error>> { ) -> Vec<Result<Option<Vec<u8>>, rust_rocksdb::Error>> {
unimplemented!() unimplemented!()
} }

View file

@ -349,7 +349,7 @@ impl KvTree for RocksDbEngineTree<'_> {
fn multi_get( fn multi_get(
&self, iter: Vec<(&Arc<rust_rocksdb::BoundColumnFamily<'_>>, Vec<u8>)>, &self, iter: Vec<(&Arc<rust_rocksdb::BoundColumnFamily<'_>>, Vec<u8>)>,
) -> Vec<std::result::Result<Option<Vec<u8>>, rust_rocksdb::Error>> { ) -> Vec<Result<Option<Vec<u8>>, rust_rocksdb::Error>> {
let mut readoptions = rust_rocksdb::ReadOptions::default(); let mut readoptions = rust_rocksdb::ReadOptions::default();
readoptions.set_total_order_seek(true); readoptions.set_total_order_seek(true);

View file

@ -1,8 +1,8 @@
#[cfg(unix)] #[cfg(unix)]
use std::fs::Permissions; // not unix specific, just only for UNIX sockets stuff and *nix container checks use std::fs::Permissions; // not unix specific, just only for UNIX sockets stuff and *nix container checks
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt as _; use std::os::unix::fs::PermissionsExt as _; /* not unix specific, just only for UNIX sockets stuff and *nix
// not unix specific, just only for UNIX sockets stuff and *nix container checks * container checks */
use std::{io, net::SocketAddr, sync::atomic, time::Duration}; use std::{io, net::SocketAddr, sync::atomic, time::Duration};
use axum::{ use axum::{
@ -313,7 +313,7 @@ async fn build(server: &Server) -> io::Result<axum::routing::IntoMakeService<Rou
async fn request_spawn<B: Send + 'static>( async fn request_spawn<B: Send + 'static>(
req: http::Request<B>, next: axum::middleware::Next<B>, req: http::Request<B>, next: axum::middleware::Next<B>,
) -> std::result::Result<axum::response::Response, StatusCode> { ) -> Result<axum::response::Response, StatusCode> {
if services().globals.shutdown.load(atomic::Ordering::Relaxed) { if services().globals.shutdown.load(atomic::Ordering::Relaxed) {
return Err(StatusCode::SERVICE_UNAVAILABLE); return Err(StatusCode::SERVICE_UNAVAILABLE);
} }
@ -324,7 +324,7 @@ async fn request_spawn<B: Send + 'static>(
async fn request_handler<B: Send + 'static>( async fn request_handler<B: Send + 'static>(
req: http::Request<B>, next: axum::middleware::Next<B>, req: http::Request<B>, next: axum::middleware::Next<B>,
) -> std::result::Result<axum::response::Response, StatusCode> { ) -> Result<axum::response::Response, StatusCode> {
let method = req.method().clone(); let method = req.method().clone();
let uri = req.uri().clone(); let uri = req.uri().clone();
let inner = next.run(req).await; let inner = next.run(req).await;

View file

@ -349,7 +349,7 @@ pub(crate) async fn process(command: DebugCommand, body: Vec<&str>) -> Result<Ro
}, },
DebugCommand::ForceDeviceListUpdates => { DebugCommand::ForceDeviceListUpdates => {
// Force E2EE device list updates for all users // Force E2EE device list updates for all users
for user_id in services().users.iter().filter_map(std::result::Result::ok) { for user_id in services().users.iter().filter_map(Result::ok) {
services().users.mark_device_key_update(&user_id)?; services().users.mark_device_key_update(&user_id)?;
} }
RoomMessageEventContent::text_plain("Marked all devices for all users as having new keys to update") RoomMessageEventContent::text_plain("Marked all devices for all users as having new keys to update")

View file

@ -231,7 +231,7 @@ impl Service {
} }
// Parse chat messages from the admin room into an AdminCommand object // Parse chat messages from the admin room into an AdminCommand object
fn parse_admin_command(&self, command_line: &str) -> std::result::Result<AdminCommand, String> { fn parse_admin_command(&self, command_line: &str) -> Result<AdminCommand, String> {
// Note: argv[0] is `@conduit:servername:`, which is treated as the main command // Note: argv[0] is `@conduit:servername:`, which is treated as the main command
let mut argv = command_line.split_whitespace().collect::<Vec<_>>(); let mut argv = command_line.split_whitespace().collect::<Vec<_>>();

View file

@ -394,21 +394,15 @@ 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(std::u32::MAX) { if intermediate <= u64::from(u32::MAX) {
(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(std::u32::MAX) / intermediate) as u32,
std::u32::MAX,
)
} }
} else if intermediate <= u64::from(std::u32::MAX) { } else if intermediate <= u64::from(u32::MAX) {
(intermediate as u32, height) (intermediate as u32, height)
} else { } else {
( (u32::MAX, (u64::from(height) * u64::from(u32::MAX) / intermediate) as u32)
std::u32::MAX,
(u64::from(height) * u64::from(std::u32::MAX) / intermediate) as u32,
)
} }
}; };

View file

@ -243,7 +243,7 @@ impl Service {
pub fn server_sees_user(&self, server: &ServerName, user_id: &UserId) -> Result<bool> { pub fn server_sees_user(&self, server: &ServerName, user_id: &UserId) -> Result<bool> {
Ok(self Ok(self
.server_rooms(server) .server_rooms(server)
.filter_map(std::result::Result::ok) .filter_map(Result::ok)
.any(|room_id: OwnedRoomId| self.is_joined(user_id, &room_id).unwrap_or(false))) .any(|room_id: OwnedRoomId| self.is_joined(user_id, &room_id).unwrap_or(false)))
} }
@ -259,7 +259,7 @@ impl Service {
Ok(self Ok(self
.rooms_joined(a) .rooms_joined(a)
.filter_map(std::result::Result::ok) .filter_map(Result::ok)
.any(|room_id| self.is_joined(b, &room_id).unwrap_or(false))) .any(|room_id| self.is_joined(b, &room_id).unwrap_or(false)))
} }