fix(codebase): Run clippy and inline some code

This commit is contained in:
funtimes909
2025-06-12 13:53:47 +12:00
parent 11cccf8343
commit f7422b1090
5 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ impl Database {
let formatted = server
.description_raw
.as_ref()
.and_then(|v| Some(server.build_formatted_description(v)));
.map(|v| server.build_formatted_description(v));
// Delete server if it's opted out
if server.check_opt_out() {
+1
View File
@@ -101,6 +101,7 @@ impl PingableServer {
}
// returns the decoded varint and how many bytes were read
#[inline(always)]
fn decode_varint(bytes: &[u8]) -> (usize, u8) {
let mut value: usize = 0;
let mut count: u8 = 0;
+1 -1
View File
@@ -152,7 +152,7 @@ impl Server {
"color" => {
if let Some(c) = value.as_str() {
let color = MinecraftColorCodes::from(c.to_string());
output.push_str(format!("§{}", color.get_code().to_string()).as_str())
output.push_str(format!("§{}", color.get_code()).as_str())
}
},
_ => (),
+1
View File
@@ -254,6 +254,7 @@ impl Scanner {
}
}
#[inline(always)]
async fn task_wrapper(socket: SocketAddrV4, pool: Database) {
let server = PingableServer::new(socket);
+3 -3
View File
@@ -18,11 +18,11 @@ pub enum RunError {
DatabaseError(#[from] sqlx::Error),
}
impl Into<usize> for RunError {
fn into(self) -> usize {
impl From<RunError> for usize {
fn from(value: RunError) -> Self {
use RunError::*;
match self {
match value {
AddressParseError(_) => 0,
IOError(_) => 1,
MalformedResponse => 2,