Update MSRV to 1.81.0

Plus a "__CARGO_FIX_YOLO=1 cargo clippy --fix"
This commit is contained in:
Lambda 2024-09-05 18:35:24 +00:00 committed by Charles Hall
parent 74589043f7
commit 3a55684623
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
14 changed files with 38 additions and 52 deletions

View file

@ -5,7 +5,6 @@ explicit_outlives_requirements = "warn"
macro_use_extern_crate = "warn" macro_use_extern_crate = "warn"
missing_abi = "warn" missing_abi = "warn"
noop_method_call = "warn" noop_method_call = "warn"
pointer_structural_match = "warn"
single_use_lifetimes = "warn" single_use_lifetimes = "warn"
unreachable_pub = "warn" unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn" unsafe_op_in_unsafe_fn = "warn"
@ -17,7 +16,7 @@ unused_qualifications = "warn"
[workspace.lints.clippy] [workspace.lints.clippy]
# Groups. Keep alphabetically sorted # Groups. Keep alphabetically sorted
pedantic = "warn" pedantic = { level = "warn", priority = -1 }
# Lints. Keep alphabetically sorted # Lints. Keep alphabetically sorted
as_conversions = "warn" as_conversions = "warn"
@ -80,7 +79,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
# See also `rust-toolchain.toml` # See also `rust-toolchain.toml`
rust-version = "1.78.0" rust-version = "1.81.0"
[lints] [lints]
workspace = true workspace = true

6
flake.lock generated
View file

@ -250,13 +250,13 @@
"rust-manifest": { "rust-manifest": {
"flake": false, "flake": false,
"locked": { "locked": {
"narHash": "sha256-aZFye4UrtlcvLHrISldx4g9uGt3thDbVlLMK5keBSj0=", "narHash": "sha256-tB9BZB6nRHDk5ELIVlGYlIjViLKBjQl52nC1avhcCwA=",
"type": "file", "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": { "original": {
"type": "file", "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": { "systems": {

View file

@ -11,7 +11,7 @@
rust-manifest = { rust-manifest = {
# Keep version in sync with rust-toolchain.toml # 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; flake = false;
}; };
}; };

View file

@ -9,7 +9,7 @@
# If you're having trouble making the relevant changes, bug a maintainer. # If you're having trouble making the relevant changes, bug a maintainer.
[toolchain] [toolchain]
channel = "1.78.0" channel = "1.81.0"
components = [ components = [
# For rust-analyzer # For rust-analyzer
"rust-src", "rust-src",

View file

@ -316,8 +316,7 @@ pub(crate) async fn register_route(
/// - Requires UIAA to verify user password /// - Requires UIAA to verify user password
/// - Changes the password of the sender user /// - Changes the password of the sender user
/// - The password hash is calculated using argon2 with 32 character salt, the /// - The password hash is calculated using argon2 with 32 character salt, the
/// plain password is /// plain password is not saved
/// not saved
/// ///
/// If `logout_devices` is true it does the following for each device except the /// If `logout_devices` is true it does the following for each device except the
/// sender device: /// sender device:

View file

@ -16,8 +16,7 @@ use crate::{services, Ar, Error, Ra, Result};
/// Allows loading room history around an event. /// Allows loading room history around an event.
/// ///
/// - Only works if the user is joined (TODO: always allow, but only show events /// - Only works if the user is joined (TODO: always allow, but only show events
/// if the user was /// if the user was joined, depending on `history_visibility`)
/// joined, depending on `history_visibility`)
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
pub(crate) async fn get_context_route( pub(crate) async fn get_context_route(
body: Ar<get_context::v3::Request>, body: Ar<get_context::v3::Request>,

View file

@ -117,8 +117,7 @@ pub(crate) async fn send_message_event_route(
/// Allows paginating through room history. /// Allows paginating through room history.
/// ///
/// - Only works if the user is joined (TODO: always allow, but only show events /// - Only works if the user is joined (TODO: always allow, but only show events
/// where the user was /// where the user was joined, depending on `history_visibility`)
/// joined, depending on `history_visibility`)
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
pub(crate) async fn get_message_events_route( pub(crate) async fn get_message_events_route(
body: Ar<get_message_events::v3::Request>, body: Ar<get_message_events::v3::Request>,

View file

@ -36,8 +36,7 @@ use crate::{
/// Synchronize the client's state with the latest state on the server. /// Synchronize the client's state with the latest state on the server.
/// ///
/// - This endpoint takes a `since` parameter which should be the `next_batch` /// - This endpoint takes a `since` parameter which should be the `next_batch`
/// value from a /// value from a previous request for incremental syncs.
/// previous request for incremental syncs.
/// ///
/// Calling this endpoint without a `since` parameter returns: /// Calling this endpoint without a `since` parameter returns:
/// - Some of the most recent events of each timeline /// - 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 /// - Some of the most recent events of each timeline that happened after
/// `since` /// `since`
/// - If user joined the room after `since`: All state events (unless lazy /// - If user joined the room after `since`: All state events (unless lazy
/// loading is activated) and /// loading is activated) and all device list updates in that room
/// all device list updates in that room
/// - If the user was already in the room: A list of all events that are in the /// - If the user was already in the room: A list of all events that are in the
/// state now, but were /// state now, but were not in the state at `since`
/// not in the state at `since`
/// - If the state we send contains a member event: Joined and invited member /// - If the state we send contains a member event: Joined and invited member
/// counts, heroes /// counts, heroes
/// - Device list updates that happened after `since` /// - Device list updates that happened after `since`

View file

@ -13,8 +13,7 @@ use crate::{services, Ar, Ra, Result};
/// Searches all known users for a match. /// Searches all known users for a match.
/// ///
/// - Hides any local users that aren't in any public rooms (i.e. those that /// - Hides any local users that aren't in any public rooms (i.e. those that
/// have the join rule set to public) /// have the join rule set to public) and don't share a room with the sender
/// and don't share a room with the sender
pub(crate) async fn search_users_route( pub(crate) async fn search_users_route(
body: Ar<search_users::v3::Request>, body: Ar<search_users::v3::Request>,
) -> Result<Ra<search_users::v3::Response>> { ) -> Result<Ra<search_users::v3::Response>> {

View file

@ -540,7 +540,7 @@ async fn request_well_known(destination: &str) -> Option<String> {
let response = services() let response = services()
.globals .globals
.default_client() .default_client()
.get(&format!("https://{destination}/.well-known/matrix/server")) .get(format!("https://{destination}/.well-known/matrix/server"))
.send() .send()
.await; .await;
debug!("Got well known response"); 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. /// Gets the public signing keys of this server.
/// ///
/// - Matrix does not support invalidating public keys, so the key returned by /// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid /// this will be valid forever.
/// forever.
// Response type for this endpoint is Json because we need to calculate a // Response type for this endpoint is Json because we need to calculate a
// signature for the response // signature for the response
pub(crate) async fn get_server_keys_route() -> Result<impl IntoResponse> { pub(crate) async fn get_server_keys_route() -> Result<impl IntoResponse> {
@ -625,8 +624,7 @@ pub(crate) async fn get_server_keys_route() -> Result<impl IntoResponse> {
/// Gets the public signing keys of this server. /// Gets the public signing keys of this server.
/// ///
/// - Matrix does not support invalidating public keys, so the key returned by /// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid /// this will be valid forever.
/// forever.
pub(crate) async fn get_server_keys_deprecated_route() -> impl IntoResponse { pub(crate) async fn get_server_keys_deprecated_route() -> impl IntoResponse {
get_server_keys_route().await get_server_keys_route().await
} }

View file

@ -1,5 +1,3 @@
use std::mem;
use ruma::{ use ruma::{
events::receipt::ReceiptEvent, serde::Raw, CanonicalJsonObject, events::receipt::ReceiptEvent, serde::Raw, CanonicalJsonObject,
OwnedUserId, RoomId, UserId, OwnedUserId, RoomId, UserId,
@ -83,7 +81,7 @@ impl service::rooms::edus::read_receipt::Data for KeyValueDatabase {
.take_while(move |(k, _)| k.starts_with(&prefix2)) .take_while(move |(k, _)| k.starts_with(&prefix2))
.map(move |(k, v)| { .map(move |(k, v)| {
let count = utils::u64_from_bytes( let count = utils::u64_from_bytes(
&k[prefix.len()..prefix.len() + mem::size_of::<u64>()], &k[prefix.len()..prefix.len() + size_of::<u64>()],
) )
.map_err(|_| { .map_err(|_| {
Error::bad_database( Error::bad_database(
@ -92,7 +90,7 @@ impl service::rooms::edus::read_receipt::Data for KeyValueDatabase {
})?; })?;
let user_id = UserId::parse( let user_id = UserId::parse(
utils::string_from_bytes( utils::string_from_bytes(
&k[prefix.len() + mem::size_of::<u64>() + 1..], &k[prefix.len() + size_of::<u64>() + 1..],
) )
.map_err(|_| { .map_err(|_| {
Error::bad_database( Error::bad_database(

View file

@ -1,4 +1,4 @@
use std::{mem, sync::Arc}; use std::sync::Arc;
use ruma::{EventId, RoomId, UserId}; use ruma::{EventId, RoomId, UserId};
@ -47,11 +47,12 @@ impl service::rooms::pdu_metadata::Data for KeyValueDatabase {
.iter_from(&current, true) .iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix)) .take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(tofrom, _data)| { .map(move |(tofrom, _data)| {
let from = utils::u64_from_bytes( let from =
&tofrom[(mem::size_of::<u64>())..], utils::u64_from_bytes(&tofrom[(size_of::<u64>())..])
)
.map_err(|_| { .map_err(|_| {
Error::bad_database("Invalid count in tofrom_relation.") Error::bad_database(
"Invalid count in tofrom_relation.",
)
})?; })?;
let mut pduid = shortroomid.get().to_be_bytes().to_vec(); let mut pduid = shortroomid.get().to_be_bytes().to_vec();

View file

@ -1,5 +1,3 @@
use std::mem;
use ruma::{ use ruma::{
api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId,
UserId, UserId,
@ -36,9 +34,8 @@ impl service::rooms::threads::Data for KeyValueDatabase {
.iter_from(&current, true) .iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix)) .take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(pduid, _users)| { .map(move |(pduid, _users)| {
let count = utils::u64_from_bytes( let count =
&pduid[(mem::size_of::<u64>())..], utils::u64_from_bytes(&pduid[(size_of::<u64>())..])
)
.map_err(|_| { .map_err(|_| {
Error::bad_database( Error::bad_database(
"Invalid pduid in threadid_userids.", "Invalid pduid in threadid_userids.",

View file

@ -175,19 +175,19 @@ impl Service {
(width, intermediate) (width, intermediate)
} else { } else {
( (
(u64::from(width) * u64::from(::std::u32::MAX) (u64::from(width) * u64::from(u32::MAX)
/ intermediate) / intermediate)
.try_into() .try_into()
.unwrap_or(u32::MAX), .unwrap_or(u32::MAX),
::std::u32::MAX, u32::MAX,
) )
} }
} else if let Ok(intermediate) = u32::try_from(intermediate) { } else if let Ok(intermediate) = u32::try_from(intermediate) {
(intermediate, height) (intermediate, height)
} else { } else {
( (
::std::u32::MAX, u32::MAX,
(u64::from(height) * u64::from(::std::u32::MAX) (u64::from(height) * u64::from(u32::MAX)
/ intermediate) / intermediate)
.try_into() .try_into()
.unwrap_or(u32::MAX), .unwrap_or(u32::MAX),