From f0a0704a934c89c89a7cb9c10d0b049c8631f673 Mon Sep 17 00:00:00 2001 From: strawberry Date: Thu, 4 Apr 2024 23:15:18 -0400 Subject: [PATCH] slight adjustments, remove some explicit annotations Signed-off-by: strawberry --- src/config/check.rs | 1 - src/database/abstraction.rs | 2 +- src/database/abstraction/rocksdb.rs | 2 +- src/main.rs | 8 ++++---- src/service/admin/debug.rs | 2 +- src/service/admin/mod.rs | 2 +- src/service/media/mod.rs | 14 ++++---------- src/service/rooms/state_cache/mod.rs | 4 ++-- 8 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/config/check.rs b/src/config/check.rs index 01bc6acd..1448a129 100644 --- a/src/config/check.rs +++ b/src/config/check.rs @@ -1,4 +1,3 @@ -// not unix specific, just only for UNIX sockets stuff and *nix container checks #[cfg(unix)] use std::path::Path; // not unix specific, just only for UNIX sockets stuff and *nix container checks diff --git a/src/database/abstraction.rs b/src/database/abstraction.rs index aa495038..cd3efa6f 100644 --- a/src/database/abstraction.rs +++ b/src/database/abstraction.rs @@ -45,7 +45,7 @@ pub(crate) trait KvTree: Send + Sync { #[cfg(feature = "rocksdb")] fn multi_get( &self, _iter: Vec<(&Arc>, Vec)>, - ) -> Vec>, rust_rocksdb::Error>> { + ) -> Vec>, rust_rocksdb::Error>> { unimplemented!() } diff --git a/src/database/abstraction/rocksdb.rs b/src/database/abstraction/rocksdb.rs index cb063a8e..23043e10 100644 --- a/src/database/abstraction/rocksdb.rs +++ b/src/database/abstraction/rocksdb.rs @@ -349,7 +349,7 @@ impl KvTree for RocksDbEngineTree<'_> { fn multi_get( &self, iter: Vec<(&Arc>, Vec)>, - ) -> Vec>, rust_rocksdb::Error>> { + ) -> Vec>, rust_rocksdb::Error>> { let mut readoptions = rust_rocksdb::ReadOptions::default(); readoptions.set_total_order_seek(true); diff --git a/src/main.rs b/src/main.rs index 80679e25..cb042049 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ #[cfg(unix)] use std::fs::Permissions; // not unix specific, just only for UNIX sockets stuff and *nix container checks #[cfg(unix)] -use std::os::unix::fs::PermissionsExt as _; -// not unix specific, just only for UNIX sockets stuff and *nix container checks +use std::os::unix::fs::PermissionsExt as _; /* not unix specific, just only for UNIX sockets stuff and *nix + * container checks */ use std::{io, net::SocketAddr, sync::atomic, time::Duration}; use axum::{ @@ -313,7 +313,7 @@ async fn build(server: &Server) -> io::Result( req: http::Request, next: axum::middleware::Next, -) -> std::result::Result { +) -> Result { if services().globals.shutdown.load(atomic::Ordering::Relaxed) { return Err(StatusCode::SERVICE_UNAVAILABLE); } @@ -324,7 +324,7 @@ async fn request_spawn( async fn request_handler( req: http::Request, next: axum::middleware::Next, -) -> std::result::Result { +) -> Result { let method = req.method().clone(); let uri = req.uri().clone(); let inner = next.run(req).await; diff --git a/src/service/admin/debug.rs b/src/service/admin/debug.rs index 8887d133..2e0a3b36 100644 --- a/src/service/admin/debug.rs +++ b/src/service/admin/debug.rs @@ -349,7 +349,7 @@ pub(crate) async fn process(command: DebugCommand, body: Vec<&str>) -> Result { // 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)?; } RoomMessageEventContent::text_plain("Marked all devices for all users as having new keys to update") diff --git a/src/service/admin/mod.rs b/src/service/admin/mod.rs index 2e6d61f6..398e1d62 100644 --- a/src/service/admin/mod.rs +++ b/src/service/admin/mod.rs @@ -231,7 +231,7 @@ impl Service { } // Parse chat messages from the admin room into an AdminCommand object - fn parse_admin_command(&self, command_line: &str) -> std::result::Result { + fn parse_admin_command(&self, command_line: &str) -> Result { // Note: argv[0] is `@conduit:servername:`, which is treated as the main command let mut argv = command_line.split_whitespace().collect::>(); diff --git a/src/service/media/mod.rs b/src/service/media/mod.rs index 7ca6a3bb..6d728a13 100644 --- a/src/service/media/mod.rs +++ b/src/service/media/mod.rs @@ -394,21 +394,15 @@ impl Service { u64::from(original_width) * u64::from(height) / u64::from(original_height) }; if use_width { - if intermediate <= u64::from(std::u32::MAX) { + if intermediate <= u64::from(u32::MAX) { (width, intermediate as u32) } else { - ( - (u64::from(width) * u64::from(std::u32::MAX) / intermediate) as u32, - std::u32::MAX, - ) + ((u64::from(width) * u64::from(u32::MAX) / intermediate) as u32, u32::MAX) } - } else if intermediate <= u64::from(std::u32::MAX) { + } else if intermediate <= u64::from(u32::MAX) { (intermediate as u32, height) } else { - ( - std::u32::MAX, - (u64::from(height) * u64::from(std::u32::MAX) / intermediate) as u32, - ) + (u32::MAX, (u64::from(height) * u64::from(u32::MAX) / intermediate) as u32) } }; diff --git a/src/service/rooms/state_cache/mod.rs b/src/service/rooms/state_cache/mod.rs index d999c519..81f33f71 100644 --- a/src/service/rooms/state_cache/mod.rs +++ b/src/service/rooms/state_cache/mod.rs @@ -243,7 +243,7 @@ impl Service { pub fn server_sees_user(&self, server: &ServerName, user_id: &UserId) -> Result { Ok(self .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))) } @@ -259,7 +259,7 @@ impl Service { Ok(self .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))) }