1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

Fix clippy lints

This commit is contained in:
Shayne Hartford 2024-11-23 00:26:53 -05:00
parent 51ddb5e2a2
commit 309e488f69
10 changed files with 12 additions and 14 deletions

View file

@ -68,7 +68,7 @@ pub enum AuthError {
/// If you want to use your own code to cache or show the auth code to the user
/// in a different way, use [`get_ms_link_code`], [`get_ms_auth_token`],
/// [`get_minecraft_token`] and [`get_profile`] instead.
pub async fn auth<'a>(email: &str, opts: AuthOpts<'a>) -> Result<AuthResult, AuthError> {
pub async fn auth(email: &str, opts: AuthOpts<'_>) -> Result<AuthResult, AuthError> {
let cached_account = if let Some(cache_file) = &opts.cache_file {
cache::get_account_in_cache(cache_file, email).await
} else {

View file

@ -137,6 +137,7 @@ pub fn death_event(query: Query<&LocalPlayerEvents, Added<Dead>>) {
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Error, Debug)]
pub enum HandlePacketError {
#[error("{0}")]

View file

@ -22,7 +22,6 @@ pub struct RawConnection {
writer: RawConnectionWriter,
/// Packets sent to this will be sent to the server.
/// A task that reads packets from the server. The client is disconnected
/// when this task ends.
read_packets_task: tokio::task::JoinHandle<()>,

View file

@ -40,7 +40,7 @@ pub struct ServerAddress {
pub port: u16,
}
impl<'a> TryFrom<&'a str> for ServerAddress {
impl TryFrom<&'_ str> for ServerAddress {
type Error = String;
/// Convert a Minecraft server address (host:port, the port is optional) to

View file

@ -209,8 +209,8 @@ pub fn compression_decoder(
/// The current protocol state must be passed as a generic.
///
/// For the non-waiting version, see [`try_read_packet`].
pub async fn read_packet<'a, P: ProtocolPacket + Debug, R>(
stream: &'a mut R,
pub async fn read_packet<P: ProtocolPacket + Debug, R>(
stream: &mut R,
buffer: &mut BytesMut,
compression_threshold: Option<u32>,
cipher: &mut Option<Aes128CfbDec>,
@ -242,8 +242,8 @@ where
Ok(Some(packet))
}
pub async fn read_raw_packet<'a, R>(
stream: &'a mut R,
pub async fn read_raw_packet<R>(
stream: &mut R,
buffer: &mut BytesMut,
compression_threshold: Option<u32>,
// this has to be a &mut Option<T> instead of an Option<&mut T> because

View file

@ -119,7 +119,7 @@ impl BitStorage {
let values_per_long = 64 / bits;
let magic_index = values_per_long - 1;
let (divide_mul, divide_add, divide_shift) = MAGIC[magic_index];
let calculated_length = (size + values_per_long - 1) / values_per_long;
let calculated_length = size.div_ceil(values_per_long);
let mask = (1 << bits) - 1;
@ -228,7 +228,7 @@ pub struct BitStorageIter<'a> {
index: usize,
}
impl<'a> Iterator for BitStorageIter<'a> {
impl Iterator for BitStorageIter<'_> {
type Item = u64;
fn next(&mut self) -> Option<Self::Item> {

View file

@ -155,7 +155,7 @@ impl<'a> FindBlocks<'a> {
}
}
impl<'a> Iterator for FindBlocks<'a> {
impl Iterator for FindBlocks<'_> {
type Item = BlockPos;
fn next(&mut self) -> Option<Self::Item> {

View file

@ -57,7 +57,7 @@ where
>,
}
impl<'w, 's, 'a, F> EntityFinder<'w, 's, F>
impl<'a, F> EntityFinder<'_, '_, F>
where
F: QueryFilter + 'static,
{

View file

@ -154,8 +154,7 @@ impl Simulation {
pub fn is_mining(&self) -> bool {
// return true if the component is present and Some
self.get_component::<azalea_client::mining::MineBlockPos>()
.map(|c| *c)
.flatten()
.and_then(|c| *c)
.is_some()
}
}

View file

@ -562,7 +562,6 @@ pub type BoxSwarmHandleFn<SS> =
/// }
/// Ok(())
/// }
impl Swarm {
/// Add a new account to the swarm. You can remove it later by calling
/// [`Client::disconnect`].