diff --git a/Cargo.toml b/Cargo.toml index d7682651..8d38d852 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ explicit_outlives_requirements = "warn" macro_use_extern_crate = "warn" missing_abi = "warn" noop_method_call = "warn" -pointer_structural_match = "warn" single_use_lifetimes = "warn" unreachable_pub = "warn" unsafe_op_in_unsafe_fn = "warn" @@ -17,7 +16,7 @@ unused_qualifications = "warn" [workspace.lints.clippy] # Groups. Keep alphabetically sorted -pedantic = "warn" +pedantic = { level = "warn", priority = -1 } # Lints. Keep alphabetically sorted as_conversions = "warn" @@ -80,7 +79,7 @@ version = "0.1.0" edition = "2021" # See also `rust-toolchain.toml` -rust-version = "1.78.0" +rust-version = "1.81.0" [lints] workspace = true diff --git a/flake.lock b/flake.lock index 3a58f74d..c63aebc0 100644 --- a/flake.lock +++ b/flake.lock @@ -250,13 +250,13 @@ "rust-manifest": { "flake": false, "locked": { - "narHash": "sha256-aZFye4UrtlcvLHrISldx4g9uGt3thDbVlLMK5keBSj0=", + "narHash": "sha256-tB9BZB6nRHDk5ELIVlGYlIjViLKBjQl52nC1avhcCwA=", "type": "file", - "url": "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml" + "url": "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml" }, "original": { "type": "file", - "url": "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml" + "url": "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml" } }, "systems": { diff --git a/flake.nix b/flake.nix index 136e1601..50fe2135 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ rust-manifest = { # Keep version in sync with rust-toolchain.toml - url = "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml"; + url = "https://static.rust-lang.org/dist/channel-rust-1.81.0.toml"; flake = false; }; }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 19939854..42c0fad3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -9,7 +9,7 @@ # If you're having trouble making the relevant changes, bug a maintainer. [toolchain] -channel = "1.78.0" +channel = "1.81.0" components = [ # For rust-analyzer "rust-src", diff --git a/src/api/client_server/account.rs b/src/api/client_server/account.rs index 25202750..d660c6ba 100644 --- a/src/api/client_server/account.rs +++ b/src/api/client_server/account.rs @@ -316,8 +316,7 @@ pub(crate) async fn register_route( /// - Requires UIAA to verify user password /// - Changes the password of the sender user /// - The password hash is calculated using argon2 with 32 character salt, the -/// plain password is -/// not saved +/// plain password is not saved /// /// If `logout_devices` is true it does the following for each device except the /// sender device: diff --git a/src/api/client_server/context.rs b/src/api/client_server/context.rs index 76f3d2f0..ba803454 100644 --- a/src/api/client_server/context.rs +++ b/src/api/client_server/context.rs @@ -16,8 +16,7 @@ use crate::{services, Ar, Error, Ra, Result}; /// Allows loading room history around an event. /// /// - Only works if the user is joined (TODO: always allow, but only show events -/// if the user was -/// joined, depending on `history_visibility`) +/// if the user was joined, depending on `history_visibility`) #[allow(clippy::too_many_lines)] pub(crate) async fn get_context_route( body: Ar, diff --git a/src/api/client_server/message.rs b/src/api/client_server/message.rs index 6f29205f..df723d07 100644 --- a/src/api/client_server/message.rs +++ b/src/api/client_server/message.rs @@ -117,8 +117,7 @@ pub(crate) async fn send_message_event_route( /// Allows paginating through room history. /// /// - Only works if the user is joined (TODO: always allow, but only show events -/// where the user was -/// joined, depending on `history_visibility`) +/// where the user was joined, depending on `history_visibility`) #[allow(clippy::too_many_lines)] pub(crate) async fn get_message_events_route( body: Ar, diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index f2985301..252036a5 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -36,8 +36,7 @@ use crate::{ /// Synchronize the client's state with the latest state on the server. /// /// - This endpoint takes a `since` parameter which should be the `next_batch` -/// value from a -/// previous request for incremental syncs. +/// value from a previous request for incremental syncs. /// /// Calling this endpoint without a `since` parameter returns: /// - Some of the most recent events of each timeline @@ -50,11 +49,9 @@ use crate::{ /// - Some of the most recent events of each timeline that happened after /// `since` /// - If user joined the room after `since`: All state events (unless lazy -/// loading is activated) and -/// all device list updates in that room +/// loading is activated) and all device list updates in that room /// - If the user was already in the room: A list of all events that are in the -/// state now, but were -/// not in the state at `since` +/// state now, but were not in the state at `since` /// - If the state we send contains a member event: Joined and invited member /// counts, heroes /// - Device list updates that happened after `since` diff --git a/src/api/client_server/user_directory.rs b/src/api/client_server/user_directory.rs index 93fbd6cd..5b866dd8 100644 --- a/src/api/client_server/user_directory.rs +++ b/src/api/client_server/user_directory.rs @@ -13,8 +13,7 @@ use crate::{services, Ar, Ra, Result}; /// Searches all known users for a match. /// /// - Hides any local users that aren't in any public rooms (i.e. those that -/// have the join rule set to public) -/// and don't share a room with the sender +/// have the join rule set to public) and don't share a room with the sender pub(crate) async fn search_users_route( body: Ar, ) -> Result> { diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 0e58a087..74eeac31 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -540,7 +540,7 @@ async fn request_well_known(destination: &str) -> Option { let response = services() .globals .default_client() - .get(&format!("https://{destination}/.well-known/matrix/server")) + .get(format!("https://{destination}/.well-known/matrix/server")) .send() .await; debug!("Got well known response"); @@ -573,8 +573,7 @@ pub(crate) async fn get_server_version_route( /// Gets the public signing keys of this server. /// /// - Matrix does not support invalidating public keys, so the key returned by -/// this will be valid -/// forever. +/// this will be valid forever. // Response type for this endpoint is Json because we need to calculate a // signature for the response pub(crate) async fn get_server_keys_route() -> Result { @@ -625,8 +624,7 @@ pub(crate) async fn get_server_keys_route() -> Result { /// Gets the public signing keys of this server. /// /// - Matrix does not support invalidating public keys, so the key returned by -/// this will be valid -/// forever. +/// this will be valid forever. pub(crate) async fn get_server_keys_deprecated_route() -> impl IntoResponse { get_server_keys_route().await } diff --git a/src/database/key_value/rooms/edus/read_receipt.rs b/src/database/key_value/rooms/edus/read_receipt.rs index a897ca6d..f8e1470f 100644 --- a/src/database/key_value/rooms/edus/read_receipt.rs +++ b/src/database/key_value/rooms/edus/read_receipt.rs @@ -1,5 +1,3 @@ -use std::mem; - use ruma::{ events::receipt::ReceiptEvent, serde::Raw, CanonicalJsonObject, OwnedUserId, RoomId, UserId, @@ -83,7 +81,7 @@ impl service::rooms::edus::read_receipt::Data for KeyValueDatabase { .take_while(move |(k, _)| k.starts_with(&prefix2)) .map(move |(k, v)| { let count = utils::u64_from_bytes( - &k[prefix.len()..prefix.len() + mem::size_of::()], + &k[prefix.len()..prefix.len() + size_of::()], ) .map_err(|_| { Error::bad_database( @@ -92,7 +90,7 @@ impl service::rooms::edus::read_receipt::Data for KeyValueDatabase { })?; let user_id = UserId::parse( utils::string_from_bytes( - &k[prefix.len() + mem::size_of::() + 1..], + &k[prefix.len() + size_of::() + 1..], ) .map_err(|_| { Error::bad_database( diff --git a/src/database/key_value/rooms/pdu_metadata.rs b/src/database/key_value/rooms/pdu_metadata.rs index 5fc6a897..2376e334 100644 --- a/src/database/key_value/rooms/pdu_metadata.rs +++ b/src/database/key_value/rooms/pdu_metadata.rs @@ -1,4 +1,4 @@ -use std::{mem, sync::Arc}; +use std::sync::Arc; use ruma::{EventId, RoomId, UserId}; @@ -47,12 +47,13 @@ impl service::rooms::pdu_metadata::Data for KeyValueDatabase { .iter_from(¤t, true) .take_while(move |(k, _)| k.starts_with(&prefix)) .map(move |(tofrom, _data)| { - let from = utils::u64_from_bytes( - &tofrom[(mem::size_of::())..], - ) - .map_err(|_| { - Error::bad_database("Invalid count in tofrom_relation.") - })?; + let from = + utils::u64_from_bytes(&tofrom[(size_of::())..]) + .map_err(|_| { + Error::bad_database( + "Invalid count in tofrom_relation.", + ) + })?; let mut pduid = shortroomid.get().to_be_bytes().to_vec(); pduid.extend_from_slice(&from.to_be_bytes()); diff --git a/src/database/key_value/rooms/threads.rs b/src/database/key_value/rooms/threads.rs index fe762fa0..8f331d4f 100644 --- a/src/database/key_value/rooms/threads.rs +++ b/src/database/key_value/rooms/threads.rs @@ -1,5 +1,3 @@ -use std::mem; - use ruma::{ api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId, @@ -36,14 +34,13 @@ impl service::rooms::threads::Data for KeyValueDatabase { .iter_from(¤t, true) .take_while(move |(k, _)| k.starts_with(&prefix)) .map(move |(pduid, _users)| { - let count = utils::u64_from_bytes( - &pduid[(mem::size_of::())..], - ) - .map_err(|_| { - Error::bad_database( - "Invalid pduid in threadid_userids.", - ) - })?; + let count = + utils::u64_from_bytes(&pduid[(size_of::())..]) + .map_err(|_| { + Error::bad_database( + "Invalid pduid in threadid_userids.", + ) + })?; let pduid = PduId::new(pduid); diff --git a/src/service/media.rs b/src/service/media.rs index a175f035..c03fd92f 100644 --- a/src/service/media.rs +++ b/src/service/media.rs @@ -175,19 +175,19 @@ impl Service { (width, intermediate) } else { ( - (u64::from(width) * u64::from(::std::u32::MAX) + (u64::from(width) * u64::from(u32::MAX) / intermediate) .try_into() .unwrap_or(u32::MAX), - ::std::u32::MAX, + u32::MAX, ) } } else if let Ok(intermediate) = u32::try_from(intermediate) { (intermediate, height) } else { ( - ::std::u32::MAX, - (u64::from(height) * u64::from(::std::u32::MAX) + u32::MAX, + (u64::from(height) * u64::from(u32::MAX) / intermediate) .try_into() .unwrap_or(u32::MAX),