run cargo fix for rust 2024 changes and rustfmt

Signed-off-by: June Clementine Strawberry <strawberry@puppygock.gay>
This commit is contained in:
June Clementine Strawberry 2025-02-23 01:17:45 -05:00
parent e97952b7f6
commit a1e1f40ded
No known key found for this signature in database
320 changed files with 2212 additions and 2039 deletions

View file

@ -1,6 +1,6 @@
use bytesize::ByteSize;
use crate::{err, Result};
use crate::{Result, err};
/// Parse a human-writable size string w/ si-unit suffix into integer
#[inline]

View file

@ -12,14 +12,14 @@ macro_rules! defer {
let _defer_ = _Defer_ { closure: || $body };
};
($body:expr) => {
($body:expr_2021) => {
$crate::defer! {{ $body }}
};
}
#[macro_export]
macro_rules! scope_restore {
($val:ident, $ours:expr) => {
($val:ident, $ours:expr_2021) => {
let theirs = $crate::utils::exchange($val, $ours);
$crate::defer! {{ *$val = theirs; }};
};

View file

@ -3,8 +3,8 @@
use std::marker::Unpin;
use futures::{
future::{select_ok, try_join, try_join_all, try_select},
Future, FutureExt,
future::{select_ok, try_join, try_join_all, try_select},
};
pub trait BoolExt

View file

@ -2,7 +2,7 @@
use std::marker::Unpin;
use futures::{future, future::Select, Future};
use futures::{Future, future, future::Select};
/// This interface is not necessarily complete; feel free to add as-needed.
pub trait ExtExt<T>

View file

@ -3,7 +3,7 @@ mod ext_ext;
mod option_ext;
mod try_ext_ext;
pub use bool_ext::{and, or, BoolExt};
pub use bool_ext::{BoolExt, and, or};
pub use ext_ext::ExtExt;
pub use option_ext::OptionExt;
pub use try_ext_ext::TryExtExt;

View file

@ -1,6 +1,6 @@
#![allow(clippy::wrong_self_convention)]
use futures::{future::OptionFuture, Future, FutureExt};
use futures::{Future, FutureExt, future::OptionFuture};
pub trait OptionExt<T> {
fn is_none_or(self, f: impl FnOnce(&T) -> bool + Send) -> impl Future<Output = bool> + Send;

View file

@ -7,9 +7,8 @@
use std::marker::Unpin;
use futures::{
future,
TryFuture, TryFutureExt, future,
future::{MapOkOrElse, TrySelect, UnwrapOrElse},
TryFuture, TryFutureExt,
};
/// This interface is not necessarily complete; feel free to add as-needed.

View file

@ -1,11 +1,11 @@
use std::sync::OnceLock;
use argon2::{
password_hash, password_hash::SaltString, Algorithm, Argon2, Params, PasswordHash,
PasswordHasher, PasswordVerifier, Version,
Algorithm, Argon2, Params, PasswordHash, PasswordHasher, PasswordVerifier, Version,
password_hash, password_hash::SaltString,
};
use crate::{err, Error, Result};
use crate::{Error, Result, err};
const M_COST: u32 = Params::DEFAULT_M_COST; // memory size in 1 KiB blocks
const T_COST: u32 = Params::DEFAULT_T_COST; // nr of iterations

View file

@ -1,6 +1,6 @@
use std::{fmt, str::FromStr};
use ruma::{canonical_json::try_from_json_map, CanonicalJsonError, CanonicalJsonObject};
use ruma::{CanonicalJsonError, CanonicalJsonObject, canonical_json::try_from_json_map};
use crate::Result;

View file

@ -6,7 +6,7 @@ use std::{cmp, convert::TryFrom};
pub use checked_ops::checked_ops;
pub use self::{expected::Expected, tried::Tried};
use crate::{debug::type_name, err, Err, Error, Result};
use crate::{Err, Error, Result, debug::type_name, err};
/// Checked arithmetic expression. Returns a Result<R, Error::Arithmetic>
#[macro_export]

View file

@ -1,6 +1,6 @@
use num_traits::ops::checked::{CheckedAdd, CheckedDiv, CheckedMul, CheckedRem, CheckedSub};
use crate::{checked, Result};
use crate::{Result, checked};
pub trait Tried {
#[inline]

View file

@ -49,7 +49,7 @@ pub fn exchange<T>(state: &mut T, source: T) -> T { std::mem::replace(state, sou
#[macro_export]
macro_rules! extract_variant {
($e:expr, $variant:path) => {
($e:expr_2021, $variant:path) => {
match $e {
| $variant(value) => Some(value),
| _ => None,
@ -90,7 +90,7 @@ macro_rules! pair_of {
($decl, $decl)
};
($init:expr) => {
($init:expr_2021) => {
($init, $init)
};
}
@ -134,7 +134,7 @@ macro_rules! is_equal_to {
|x| x == $val
};
($val:expr) => {
($val:expr_2021) => {
|x| x == $val
};
}
@ -146,7 +146,7 @@ macro_rules! is_less_than {
|x| x < $val
};
($val:expr) => {
($val:expr_2021) => {
|x| x < $val
};
}

View file

@ -6,7 +6,7 @@ use std::{
use tokio::sync::OwnedMutexGuard as Omg;
use crate::{err, Result};
use crate::{Result, err};
/// Map of Mutexes
pub struct MutexMap<Key, Val> {

View file

@ -4,7 +4,7 @@ use std::{
};
use arrayvec::ArrayString;
use rand::{seq::SliceRandom, thread_rng, Rng};
use rand::{Rng, seq::SliceRandom, thread_rng};
pub fn shuffle<T>(vec: &mut [T]) {
let mut rng = thread_rng();

View file

@ -3,11 +3,11 @@
use std::convert::identity;
use futures::{
stream::{Stream, StreamExt},
Future,
stream::{Stream, StreamExt},
};
use super::{automatic_width, ReadyExt};
use super::{ReadyExt, automatic_width};
/// Concurrency extensions to augment futures::StreamExt. broad_ combinators
/// produce out-of-order

View file

@ -1,6 +1,6 @@
use std::clone::Clone;
use futures::{stream::Map, Stream, StreamExt};
use futures::{Stream, StreamExt, stream::Map};
pub trait Cloned<'a, T, S>
where

View file

@ -1,4 +1,4 @@
use futures::{future::ready, Stream, StreamExt, TryStream};
use futures::{Stream, StreamExt, TryStream, future::ready};
use crate::{Error, Result};

View file

@ -1,7 +1,6 @@
use futures::{
stream,
StreamExt, stream,
stream::{Stream, TryStream},
StreamExt,
};
use crate::{Error, Result};

View file

@ -14,8 +14,8 @@ mod try_wideband;
mod wideband;
pub use band::{
automatic_amplification, automatic_width, set_amplification, set_width, AMPLIFICATION_LIMIT,
WIDTH_LIMIT,
AMPLIFICATION_LIMIT, WIDTH_LIMIT, automatic_amplification, automatic_width,
set_amplification, set_width,
};
pub use broadband::BroadbandExt;
pub use cloned::Cloned;

View file

@ -2,7 +2,7 @@
#![allow(clippy::type_complexity)]
use futures::{
future::{ready, Ready},
future::{Ready, ready},
stream::{
All, Any, Filter, FilterMap, Fold, ForEach, Scan, SkipWhile, Stream, StreamExt, TakeWhile,
},

View file

@ -1,10 +1,10 @@
//! Parallelism stream combinator extensions to futures::Stream
use futures::{stream::TryStream, TryFutureExt};
use futures::{TryFutureExt, stream::TryStream};
use tokio::{runtime, task::JoinError};
use super::TryBroadbandExt;
use crate::{utils::sys::available_parallelism, Error, Result};
use crate::{Error, Result, utils::sys::available_parallelism};
/// Parallelism extensions to augment futures::StreamExt. These combinators are
/// for computation-oriented workloads, unlike -band combinators for I/O

View file

@ -2,7 +2,7 @@
#![allow(clippy::type_complexity)]
use futures::{
future::{ready, Ready},
future::{Ready, ready},
stream::{AndThen, TryFilterMap, TryFold, TryForEach, TryStream, TryStreamExt, TryTakeWhile},
};

View file

@ -1,7 +1,7 @@
//! TryStreamTools for futures::TryStream
#![allow(clippy::type_complexity)]
use futures::{future, future::Ready, stream::TryTakeWhile, TryStream, TryStreamExt};
use futures::{TryStream, TryStreamExt, future, future::Ready, stream::TryTakeWhile};
use crate::Result;

View file

@ -3,11 +3,11 @@
use std::convert::identity;
use futures::{
stream::{Stream, StreamExt},
Future,
stream::{Stream, StreamExt},
};
use super::{automatic_width, ReadyExt};
use super::{ReadyExt, automatic_width};
/// Concurrency extensions to augment futures::StreamExt. wideband_ combinators
/// produce in-order.

View file

@ -5,7 +5,7 @@ mod unquote;
mod unquoted;
pub use self::{between::Between, split::SplitInfallible, unquote::Unquote, unquoted::Unquoted};
use crate::{utils::exchange, Result};
use crate::{Result, utils::exchange};
pub const EMPTY: &str = "";

View file

@ -1,9 +1,9 @@
use std::ops::Deref;
use serde::{de, Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, de};
use super::Unquote;
use crate::{err, Result};
use crate::{Result, err};
/// Unquoted string which deserialized from a quoted string. Construction from a
/// &str is infallible such that the input can already be unquoted. Construction

View file

@ -5,7 +5,7 @@ use std::path::PathBuf;
pub use compute::available_parallelism;
use crate::{debug, Result};
use crate::{Result, debug};
/// This is needed for opening lots of file descriptors, which tends to
/// happen more often when using RocksDB and making lots of federation
@ -16,7 +16,7 @@ use crate::{debug, Result};
/// * <https://github.com/systemd/systemd/commit/0abf94923b4a95a7d89bc526efc84e7ca2b71741>
#[cfg(unix)]
pub fn maximize_fd_limit() -> Result<(), nix::errno::Errno> {
use nix::sys::resource::{getrlimit, setrlimit, Resource::RLIMIT_NOFILE as NOFILE};
use nix::sys::resource::{Resource::RLIMIT_NOFILE as NOFILE, getrlimit, setrlimit};
let (soft_limit, hard_limit) = getrlimit(NOFILE)?;
if soft_limit < hard_limit {

View file

@ -2,7 +2,7 @@
use std::{cell::Cell, fmt::Debug, path::PathBuf, sync::LazyLock};
use crate::{is_equal_to, Result};
use crate::{Result, is_equal_to};
type Id = usize;
@ -45,7 +45,7 @@ pub fn set_affinity<I>(mut ids: I)
where
I: Iterator<Item = Id> + Clone + Debug,
{
use core_affinity::{set_each_for_current, set_for_current, CoreId};
use core_affinity::{CoreId, set_each_for_current, set_for_current};
let n = ids.clone().count();
let mask: Mask = ids.clone().fold(0, |mask, id| {
@ -118,7 +118,7 @@ pub fn cores_available() -> impl Iterator<Item = Id> { from_mask(*CORES_AVAILABL
#[cfg(target_os = "linux")]
#[inline]
pub fn getcpu() -> Result<usize> {
use crate::{utils::math, Error};
use crate::{Error, utils::math};
// SAFETY: This is part of an interface with many low-level calls taking many
// raw params, but it's unclear why this specific call is unsafe. Nevertheless

View file

@ -3,7 +3,7 @@
use std::{
ffi::OsStr,
fs,
fs::{read_to_string, FileType},
fs::{FileType, read_to_string},
iter::IntoIterator,
path::{Path, PathBuf},
};
@ -11,9 +11,9 @@ use std::{
use libc::dev_t;
use crate::{
Result,
result::FlatOk,
utils::{result::LogDebugErr, string::SplitInfallible},
Result,
};
/// Device characteristics useful for random access throughput

View file

@ -241,7 +241,7 @@ fn set_intersection_sorted_all() {
#[tokio::test]
async fn set_intersection_sorted_stream2() {
use futures::StreamExt;
use utils::{set::intersection_sorted_stream2, IterStream};
use utils::{IterStream, set::intersection_sorted_stream2};
let a = ["bar"];
let b = ["bar", "foo"];

View file

@ -2,7 +2,7 @@ pub mod exponential_backoff;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use crate::{err, Result};
use crate::{Result, err};
#[inline]
#[must_use]