Skip to content

Commit

Permalink
Bump dependencies and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 9, 2025
1 parent 6223f46 commit 3687db9
Show file tree
Hide file tree
Showing 31 changed files with 68 additions and 87 deletions.
5 changes: 3 additions & 2 deletions server/central/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ use std::{
};

use globed_shared::{
ADMIN_KEY_LENGTH, DEFAULT_GAME_SERVER_PORT, Decodable, Encodable, ServerRole,
anyhow::{self, anyhow},
esp::{self, Decodable, Encodable},
generate_alphanum_string, Decodable, Encodable, ServerRole, ADMIN_KEY_LENGTH, DEFAULT_GAME_SERVER_PORT,
generate_alphanum_string,
};
use json_comments::StripComments;
use serde::{Deserialize, Serialize};
use serde_json::{ser::PrettyFormatter, Serializer};
use serde_json::{Serializer, ser::PrettyFormatter};

/* stinky serde defaults */

Expand Down
4 changes: 2 additions & 2 deletions server/central/src/db/dbimpl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use globed_shared::{debug, AdminPunishUserAction, PunishmentType, ServerUserEntry, UserPunishment};
use rocket_db_pools::sqlx::{query_as, Result};
use globed_shared::{AdminPunishUserAction, PunishmentType, ServerUserEntry, UserPunishment, debug};
use rocket_db_pools::sqlx::{Result, query_as};
use serde::Serialize;
use sqlx::{prelude::*, query, query_scalar, sqlite::SqliteRow};

Expand Down
2 changes: 1 addition & 1 deletion server/central/src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use globed_shared::{error, info};
use rocket::{
fairing::{self, AdHoc},
Build, Rocket,
fairing::{self, AdHoc},
};
use rocket_db_pools::Database;

Expand Down
4 changes: 2 additions & 2 deletions server/central/src/game_pinger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use std::{
};

use globed_shared::{
debug,
SyncMutex, debug,
esp::{ByteBuffer, ByteBufferExtRead, ByteBufferExtWrite, ByteReader},
rand::{self, Rng},
warn, SyncMutex,
warn,
};
use tokio::net::UdpSocket;

Expand Down
13 changes: 3 additions & 10 deletions server/central/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

use globed_shared::{
anyhow::bail,
base64::{engine::general_purpose as b64e, Engine as _},
base64::{Engine as _, engine::general_purpose as b64e},
*,
};

Expand Down Expand Up @@ -170,20 +170,13 @@ impl AccountVerifier {
#[cfg(not(debug_assertions))]
trace!(
"{} ({} / userid {}): {}",
message.name,
message.account_id,
message.user_id,
message.authcode
message.name, message.account_id, message.user_id, message.authcode
);

#[cfg(debug_assertions)]
trace!(
"{} ({} / userid {}): {} ({})",
message.name,
message.account_id,
message.user_id,
message.authcode,
message.age
message.name, message.account_id, message.user_id, message.authcode, message.age
);
}
trace!("------------------------------------");
Expand Down
2 changes: 1 addition & 1 deletion server/central/src/web/guards/decodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::*;

use globed_shared::esp::{ByteBuffer, ByteBufferExtRead, Decodable, DecodeError};
use rocket::{
data::{self, FromData, ToByteUnit},
Data, Request,
data::{self, FromData, ToByteUnit},
};
use tokio::io::AsyncReadExt;

Expand Down
2 changes: 1 addition & 1 deletion server/central/src/web/guards/encrypted_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::{num::ParseIntError, sync::OnceLock};
use super::*;
use globed_shared::{CryptoBox, CryptoBoxError};
use rocket::{
data::{self, FromData, ToByteUnit},
Data,
data::{self, FromData, ToByteUnit},
};
use serde::de::DeserializeOwned;
use tokio::io::AsyncReadExt;
Expand Down
2 changes: 1 addition & 1 deletion server/central/src/web/guards/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::net::IpAddr;

use rocket::{
Request,
http::Status,
request::{FromRequest, Outcome},
Request,
};

pub mod check_protocol_;
Expand Down
6 changes: 3 additions & 3 deletions server/central/src/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod responders;
pub use guards::*;
pub use responders::*;

use rocket::{catch, Request};
use rocket::{Request, catch};

#[catch(404)]
pub fn not_found(_req: &Request) -> &'static str {
Expand Down Expand Up @@ -33,8 +33,8 @@ pub mod routes {

pub use super::*;
pub use crate::{db::GlobedDb, state::ServerState};
pub use rocket::{get, post, State};
use rocket::{routes, Route};
use rocket::{Route, routes};
pub use rocket::{State, get, post};

pub fn build_router() -> Vec<Route> {
routes![
Expand Down
8 changes: 4 additions & 4 deletions server/central/src/web/responders/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::error::Error;

use rocket::{
Request,
http::Status,
response::{Responder, Response},
Request,
};

pub mod maintenance;
Expand All @@ -13,16 +13,16 @@ pub mod generic;
pub use generic::{GenericErrorResponder, WebResult};

pub mod unauthorized_;
pub(crate) use unauthorized_::unauthorized;
pub use unauthorized_::UnauthorizedResponder;
pub(crate) use unauthorized_::unauthorized;

pub mod bad_request_;
pub(crate) use bad_request_::bad_request;
pub use bad_request_::BadRequestResponder;
pub(crate) use bad_request_::bad_request;

pub mod not_found_;
pub(crate) use not_found_::not_found;
pub use not_found_::NotFoundResponder;
pub(crate) use not_found_::not_found;

pub mod encodable;
pub use encodable::{CheckedEncodableResponder, EncodableResponder};
4 changes: 2 additions & 2 deletions server/central/src/web/routes/featured.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use globed_shared::{warn, webhook};
use rocket::{get, post, serde::json::Json, State};
use rocket::{State, get, post, serde::json::Json};
use serde::Deserialize;

use crate::{
db::{dbimpl::FeaturedLevelPage, FeaturedLevel, GlobedDb},
db::{FeaturedLevel, GlobedDb, dbimpl::FeaturedLevelPage},
state::ServerState,
web::*,
};
Expand Down
6 changes: 3 additions & 3 deletions server/central/src/web/routes/game_server.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::net::IpAddr;

use globed_shared::{
esp::{types::FastString, ByteBuffer, ByteBufferExtWrite},
logger::debug,
GameServerBootData, MAX_SUPPORTED_PROTOCOL, SERVER_MAGIC,
esp::{ByteBuffer, ByteBufferExtWrite, types::FastString},
logger::debug,
};

use rocket::{post, State};
use rocket::{State, post};

use crate::{config::UserlistMode, state::ServerState, web::*};

Expand Down
4 changes: 2 additions & 2 deletions server/central/src/web/routes/public.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::time::{Duration, SystemTime};

use crate::{
db::{dbimpl::PlayerCountHistoryEntry, GlobedDb},
db::{GlobedDb, dbimpl::PlayerCountHistoryEntry},
state::ServerState,
};

use super::*;
use rocket::{get, serde::json::Json, State};
use rocket::{State, get, serde::json::Json};
use serde::Serialize;

#[derive(Serialize)]
Expand Down
6 changes: 1 addition & 5 deletions server/derive/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ pub(crate) struct BitfieldAttributes {
impl BitfieldAttributes {
pub fn parse(input: &DeriveInput) -> Option<Self> {
let res = Self::from_derive_input(input).expect("Failed to parse bitfield attributes");
if res.on.unwrap_or(false) {
Some(res)
} else {
None
}
if res.on.unwrap_or(false) { Some(res) } else { None }
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod encode;
use attrs::{BitfieldAttributes, DynamicSizeAttributes, PacketAttributes};
use darling::FromDeriveInput;
use proc_macro::{self, Span, TokenStream};
use quote::{quote, ToTokens};
use syn::{parse_macro_input, punctuated::Punctuated, Data, DataStruct, DeriveInput, Meta, Token, Type};
use quote::{ToTokens, quote};
use syn::{Data, DataStruct, DeriveInput, Meta, Token, Type, parse_macro_input, punctuated::Punctuated};

/// Implements `Encodable` for the given type, allowing you to serialize it into a `ByteBuffer` or a `FastByteBuffer`.
/// For `Encodable` to be successfully derived, for structs, all of the members of the struct must also implement `Encodable`.
Expand All @@ -35,7 +35,7 @@ pub fn derive_encodable(input: TokenStream) -> TokenStream {
return quote! {
compile_error!("Encodable cannot be derived for unions");
}
.into()
.into();
}
};

Expand Down
6 changes: 1 addition & 5 deletions server/esp/src/types/either.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use crate::*;

const fn constmax(a: usize, b: usize) -> usize {
if a >= b {
a
} else {
b
}
if a >= b { a } else { b }
}

#[derive(Clone, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions server/game/benchmarks/bench.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::wildcard_imports, clippy::cast_possible_truncation)]
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use esp::{ByteBuffer, ByteReader};
use globed_game_server::{data::*, make_uninit, managers::LevelManager, new_uninit};
use globed_shared::{
Expand Down Expand Up @@ -169,7 +169,7 @@ fn strings(c: &mut Criterion) {
buf_long.write_value(&generate_alphanum_string(rand::thread_rng().gen_range(164..512)));
}

let mut output = ByteBuffer::with_capacity(buf_long.len() + 1024);
let output = ByteBuffer::with_capacity(buf_long.len() + 1024);

c.bench_function("read-string-short", |b| {
b.iter(|| {
Expand Down
2 changes: 1 addition & 1 deletion server/game/src/client/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{fmt::Display, time::SystemTimeError};

use crate::{
bridge::CentralBridgeError,
data::{types::ColorParseError, DecodeError},
data::{DecodeError, types::ColorParseError},
};
use globed_shared::reqwest;

Expand Down
2 changes: 1 addition & 1 deletion server/game/src/client/thread/handlers/game.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::{atomic::Ordering, Arc};
use std::sync::{Arc, atomic::Ordering};

use super::*;

Expand Down
10 changes: 6 additions & 4 deletions server/game/src/client/thread/handlers/room.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::borrow::Cow;
use crate::webhook::{WebhookChannel, WebhookMessage};
use std::borrow::Cow;

use super::*;

Expand All @@ -25,7 +25,11 @@ impl ClientThread {
};

if let Some(reason) = fail_reason {
return self.send_packet_dynamic(&RoomCreateFailedPacket { reason: Cow::Borrowed(reason) }).await;
return self
.send_packet_dynamic(&RoomCreateFailedPacket {
reason: Cow::Borrowed(reason),
})
.await;
}

let room = self
Expand Down Expand Up @@ -226,8 +230,6 @@ impl ClientThread {
room_password,
};



thread.push_new_message(ServerThreadMessage::BroadcastInvite(invite_packet.clone())).await;
}

Expand Down
4 changes: 2 additions & 2 deletions server/game/src/client/translator/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mod general;
mod room;

#[allow(unused)]
pub use super::{Packet, PacketTranslationError, Translatable, CURRENT_PROTOCOL};
pub use super::{CURRENT_PROTOCOL, Packet, PacketTranslationError, Translatable};
#[allow(unused)]
pub use crate::data::{v13, v_current, Decodable, DynamicSize, Encodable, StaticSize};
pub use crate::data::{Decodable, DynamicSize, Encodable, StaticSize, v_current, v13};
#[allow(unused)]
pub use v_current::{packets::*, types::*};
2 changes: 1 addition & 1 deletion server/game/src/client/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use esp::{ByteReader, Decodable, DecodeResult};

pub use crate::data::{Packet, CURRENT_PROTOCOL};
pub use crate::data::{CURRENT_PROTOCOL, Packet};

mod error;
mod impls;
Expand Down
8 changes: 4 additions & 4 deletions server/game/src/client/unauthorized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ use std::{
borrow::Cow,
net::SocketAddrV4,
sync::{
atomic::{AtomicBool, AtomicI32, AtomicU16, AtomicU32, Ordering},
Arc,
atomic::{AtomicBool, AtomicI32, AtomicU16, AtomicU32, Ordering},
},
time::Duration,
};

use globed_shared::{MAX_SUPPORTED_PROTOCOL, ServerUserEntry, should_ignore_error};
#[allow(unused_imports)]
use globed_shared::{
debug, info,
MIN_CLIENT_VERSION, MIN_SUPPORTED_PROTOCOL, SUPPORTED_PROTOCOLS, SyncMutex, debug, info,
rand::{self, Rng},
warn, SyncMutex, MIN_CLIENT_VERSION, MIN_SUPPORTED_PROTOCOL, SUPPORTED_PROTOCOLS,
warn,
};
use globed_shared::{should_ignore_error, ServerUserEntry, MAX_SUPPORTED_PROTOCOL};

use super::*;
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion server/game/src/data/v13/types/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io::Read;

use esp::*;
use globed_shared::crypto_box::{PublicKey, KEY_SIZE};
use globed_shared::crypto_box::{KEY_SIZE, PublicKey};

pub struct CryptoPublicKey(pub PublicKey);

Expand Down
15 changes: 6 additions & 9 deletions server/game/src/managers/level.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use globed_shared::IntMap;

use crate::data::{
types::PlayerData, AssociatedPlayerData, AssociatedPlayerMetadata, BorrowedAssociatedPlayerData, BorrowedAssociatedPlayerMetadata,
GlobedCounterChange, LevelId, PlayerMetadata,
AssociatedPlayerData, AssociatedPlayerMetadata, BorrowedAssociatedPlayerData, BorrowedAssociatedPlayerMetadata, GlobedCounterChange, LevelId,
PlayerMetadata, types::PlayerData,
};

#[derive(Default)]
Expand Down Expand Up @@ -71,14 +71,11 @@ impl LevelManager {
}

pub fn create_player(&mut self, account_id: i32, invisible: bool) {
self.players.insert(
self.players.insert(account_id, LevelManagerPlayer {
account_id,
LevelManagerPlayer {
account_id,
is_invisible: invisible,
..Default::default()
},
);
is_invisible: invisible,
..Default::default()
});
}

fn get_or_create_player(&mut self, account_id: i32) -> &mut LevelManagerPlayer {
Expand Down
Loading

0 comments on commit 3687db9

Please sign in to comment.