mirror of
https://git.funtimes909.xyz/ServerSeekerV2/ServerSeekerV2.git
synced 2026-10-10 12:13:08 +08:00
fix(codebase): Run clippy and inline some code
This commit is contained in:
+1
-1
@@ -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() {
|
||||
|
||||
@@ -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
@@ -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())
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
|
||||
@@ -254,6 +254,7 @@ impl Scanner {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
async fn task_wrapper(socket: SocketAddrV4, pool: Database) {
|
||||
let server = PingableServer::new(socket);
|
||||
|
||||
|
||||
+3
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user