1
0
Fork 0
forked from mirror/grapevine

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"
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

View file

@ -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": {

View file

@ -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;
};
};

View file

@ -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",

View file

@ -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:

View file

@ -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<get_context::v3::Request>,

View file

@ -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<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.
///
/// - 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`

View file

@ -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<search_users::v3::Request>,
) -> Result<Ra<search_users::v3::Response>> {

View file

@ -540,7 +540,7 @@ async fn request_well_known(destination: &str) -> Option<String> {
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<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.
///
/// - 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
}

View file

@ -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::<u64>()],
&k[prefix.len()..prefix.len() + size_of::<u64>()],
)
.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::<u64>() + 1..],
&k[prefix.len() + size_of::<u64>() + 1..],
)
.map_err(|_| {
Error::bad_database(

View file

@ -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(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(tofrom, _data)| {
let from = utils::u64_from_bytes(
&tofrom[(mem::size_of::<u64>())..],
)
.map_err(|_| {
Error::bad_database("Invalid count in tofrom_relation.")
})?;
let from =
utils::u64_from_bytes(&tofrom[(size_of::<u64>())..])
.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());

View file

@ -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(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(pduid, _users)| {
let count = utils::u64_from_bytes(
&pduid[(mem::size_of::<u64>())..],
)
.map_err(|_| {
Error::bad_database(
"Invalid pduid in threadid_userids.",
)
})?;
let count =
utils::u64_from_bytes(&pduid[(size_of::<u64>())..])
.map_err(|_| {
Error::bad_database(
"Invalid pduid in threadid_userids.",
)
})?;
let pduid = PduId::new(pduid);

View file

@ -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),