chore: cargo clippy

This commit is contained in:
amizing25
2025-06-30 15:10:50 +07:00
parent 8d8686692e
commit bd40dc058f
7 changed files with 9398 additions and 505 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ impl_from!(Relic, BattleRelic, |value| {
impl_from!(Relic, EquipRelic, |value| {
EquipRelic {
slot: value.get_slot(),
r#type: value.get_slot(),
relic_unique_id: value.get_unique_id(),
}
});
+4 -8
View File
@@ -129,10 +129,9 @@ impl Gateway {
if events
.iter()
.any(|p| p.path.file_name() == path.file_name())
{
if let Ok(metadata) = std::fs::metadata(path) {
if let Ok(modified) = metadata.modified() {
if modified > last_modified {
&& let Ok(metadata) = std::fs::metadata(path)
&& let Ok(modified) = metadata.modified()
&& modified > last_modified {
last_modified = modified;
let mut session = session.write().await;
@@ -143,10 +142,7 @@ impl Gateway {
}
}
}
}
}
}
Err(e) => eprintln!("json watcher error: {:?}", e),
Err(e) => eprintln!("json watcher error: {e:?}"),
}
}
_ = shutdown_rx.changed() => {
+2 -2
View File
@@ -118,7 +118,7 @@ pub async fn on_send_msg_cs_req(
session
.send(RevcMsgScNotify {
msg_type: body.msg_type,
text: format!("Success change mc to {:#?}", mc),
text: format!("Success change mc to {mc:#?}"),
emote: body.emote,
from_uid: SERVER_UID,
to_uid: 25,
@@ -156,7 +156,7 @@ pub async fn on_send_msg_cs_req(
session
.send(RevcMsgScNotify {
msg_type: body.msg_type,
text: format!("Success change march to {:#?}", march_type),
text: format!("Success change march to {march_type:#?}"),
emote: body.emote,
from_uid: SERVER_UID,
to_uid: 25,
+1 -1
View File
@@ -118,7 +118,7 @@ pub async fn on_get_scene_map_info_cs_req(
map_info
.chest_unlock_progress_list
.push(ChestUnlockProgress {
chest_type: 0,
r#type: 0,
total_chest_count: 25,
unlocked_chest_count: 25,
});
+1 -5
View File
@@ -528,11 +528,7 @@ impl<Output> Kcp<Output> {
self.rx_srtt = rtt;
self.rx_rttval = rtt / 2;
} else {
let delta = if rtt > self.rx_srtt {
rtt - self.rx_srtt
} else {
self.rx_srtt - rtt
};
let delta = rtt.abs_diff(self.rx_srtt);
self.rx_rttval = (3 * self.rx_rttval + delta) / 4;
self.rx_srtt = ((7 * u64::from(self.rx_srtt) + u64::from(rtt)) / 8) as u32;
if self.rx_srtt < 1 {
+9308 -406
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -31,7 +31,7 @@ pub async fn sr_tool_save(Json(json): Json<SrToolDataReq>) -> Json<SrToolDataRsp
Ok(json) => json,
Err(err) => {
return Json(SrToolDataRsp {
message: format!("malformed json: {}", err),
message: format!("malformed json: {err}"),
status: 500,
});
}
@@ -43,8 +43,7 @@ pub async fn sr_tool_save(Json(json): Json<SrToolDataReq>) -> Json<SrToolDataRsp
if let Err(err) = fs::write(&path, json).await {
return Json(SrToolDataRsp {
message: format!(
"failed to write freesr-data.json: {} at path: {:#?} env: {:#?}",
err, path, env
"failed to write freesr-data.json: {err} at path: {path:#?} env: {env:#?}"
),
status: 500,
});