mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Clippy improvements
This commit is contained in:
@@ -417,7 +417,7 @@ impl System {
|
||||
}
|
||||
let perm = SystemPermission::from_str(params[1]);
|
||||
if perm.is_none() {
|
||||
return format!("Unrecognised permission \"{}\" (try dev, admin, or mod)", ¶ms[1]);
|
||||
return format!("Unrecognised permission \"{}\" (try dev, admin, or mod)", params[1]);
|
||||
}
|
||||
let perm = perm.unwrap();
|
||||
if let Err(e) = ctx.user.set_permission(params[2].to_owned(), perm.role(), perm.value()).await {
|
||||
@@ -427,7 +427,7 @@ impl System {
|
||||
format!("Failed to grant permission (code {})", e.error_code())
|
||||
}
|
||||
} else {
|
||||
format!("Granted {} to {} (they should re-log)", perm.display(), ¶ms[2])
|
||||
format!("Granted {} to {} (they should re-log)", perm.display(), params[2])
|
||||
}
|
||||
},
|
||||
Self::ClearGarageFactoryFlag => {
|
||||
|
||||
@@ -29,7 +29,7 @@ impl <D: serde::de::DeserializeOwned + 'static> IntercomListener<D> {
|
||||
stream.filter_map(move |msg_res| {
|
||||
let sink = sink.clone();
|
||||
Box::pin(async move {
|
||||
let res = match msg_res.ok() {
|
||||
match msg_res.ok() {
|
||||
None => None,
|
||||
/*reqwest_websocket::Message::Text(s) => {
|
||||
(serde_json::from_str(&s).map_err(reqwest_websocket::Error::Json), None)
|
||||
@@ -48,8 +48,7 @@ impl <D: serde::de::DeserializeOwned + 'static> IntercomListener<D> {
|
||||
None
|
||||
},
|
||||
Some(msg) => Some(msg.json())
|
||||
};
|
||||
res
|
||||
}
|
||||
}
|
||||
)})
|
||||
}
|
||||
@@ -87,7 +86,7 @@ impl <D: serde::ser::Serialize + serde::de::DeserializeOwned + 'static> Intercom
|
||||
let stream_impl = stream.filter_map(move |msg_res| {
|
||||
let sink = sink.clone();
|
||||
Box::pin(async move {
|
||||
let res = match msg_res.ok() {
|
||||
match msg_res.ok() {
|
||||
None => None,
|
||||
/*reqwest_websocket::Message::Text(s) => {
|
||||
(serde_json::from_str(&s).map_err(reqwest_websocket::Error::Json), None)
|
||||
@@ -106,8 +105,7 @@ impl <D: serde::ser::Serialize + serde::de::DeserializeOwned + 'static> Intercom
|
||||
None
|
||||
},
|
||||
Some(msg) => Some(msg.json())
|
||||
};
|
||||
res
|
||||
}
|
||||
}
|
||||
)});
|
||||
(sink_impl, stream_impl)
|
||||
|
||||
@@ -37,7 +37,7 @@ impl ArcAdapter {
|
||||
|
||||
fn thumbnail_url(&self, meta: String, id: u32) -> String {
|
||||
if self.override_cdn && id <= 7_946_212 {
|
||||
format!("{}/roboshop/arc/Live/{}", &self.cdn, id)
|
||||
format!("{}/roboshop/arc/Live/{}", self.cdn, id)
|
||||
} else {
|
||||
meta
|
||||
}
|
||||
@@ -281,7 +281,7 @@ impl crate::VehicleFactoryAdapter for ArcAdapter {
|
||||
}.insert(&transaction).await?;
|
||||
super::entities::robot_metadata::ActiveModel {
|
||||
id: Set(cubes.id),
|
||||
thumbnail: Set(format!("{}/roboshop/Live/{}", &self.cdn, cubes.id)),
|
||||
thumbnail: Set(format!("{}/roboshop/Live/{}", self.cdn, cubes.id)),
|
||||
..Default::default()
|
||||
}.update(&transaction).await?;
|
||||
transaction.commit().await?;
|
||||
|
||||
@@ -1300,8 +1300,7 @@ impl BattleArenaLogic {
|
||||
let connections = generic.users.read().await.values().map(|player_info| player_info.connection.clone()).collect();
|
||||
let my_connection_latency = generic.users.read().await
|
||||
.iter()
|
||||
.filter(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.next()
|
||||
.find(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.unwrap()
|
||||
.1.connection.connection.latency();
|
||||
tokio::task::spawn(super::respawn_player_after(
|
||||
|
||||
@@ -370,8 +370,7 @@ impl PitLogic {
|
||||
let connections = generic.users.read().await.values().map(|player_info| player_info.connection.clone()).collect();
|
||||
let my_connection_latency = generic.users.read().await
|
||||
.iter()
|
||||
.filter(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.next()
|
||||
.find(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.unwrap()
|
||||
.1.connection.connection.latency();
|
||||
tokio::task::spawn(super::respawn_player_after(
|
||||
|
||||
@@ -308,11 +308,10 @@ impl TeamDeathMatchLogic {
|
||||
if let Some(player_desc) = generic.user_descriptor(player_id) {
|
||||
let connections = generic.users.read().await.values().map(|player_info| player_info.connection.clone()).collect();
|
||||
let my_connection_latency = generic.users.read().await
|
||||
.iter()
|
||||
.filter(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.next()
|
||||
.unwrap()
|
||||
.1.connection.connection.latency();
|
||||
.iter()
|
||||
.find(|(user_player_id, _)| **user_player_id == player_id)
|
||||
.unwrap()
|
||||
.1.connection.connection.latency();
|
||||
tokio::task::spawn(super::respawn_player_after(
|
||||
respawn_timestamp,
|
||||
connections,
|
||||
|
||||
@@ -56,7 +56,7 @@ impl IntercomHandler {
|
||||
}
|
||||
IntercomWebServiceUserMessage::Workaround(IntercomWorkaroundMessage::KeybindLockout { }) => {
|
||||
let session = keybind_workaround.add_user(user.account_id(), user.public_id().to_owned()).await;
|
||||
let non_me = session.users.iter().next().unwrap();
|
||||
let non_me = session.users.first().unwrap();
|
||||
let event = super::CustomGameInvite {
|
||||
inviter_public_id: non_me.public_id.clone(),
|
||||
inviter_display_name: non_me.public_id.clone(),
|
||||
|
||||
@@ -23,10 +23,8 @@ impl <C: Send + 'static> SimpleOperation<C> for CustomGameRetriever {
|
||||
let game_opt = if let Some(session) = self.keylock_workaround.get_user(user_info.account_id(), my_pub_id).await {
|
||||
is_workaround = true;
|
||||
Some(session)
|
||||
} else if let Some(session) = self.games.get_user_game(my_pub_id).await {
|
||||
Some(session)
|
||||
} else {
|
||||
None
|
||||
self.games.get_user_game(my_pub_id).await
|
||||
};
|
||||
if let Some(game) = game_opt {
|
||||
log::debug!("User {} retrieved their custom game session {} info", my_pub_id, game.session_id);
|
||||
|
||||
@@ -26,10 +26,8 @@ impl <C: Send + 'static> SimpleOperation<C> for CustomGamePendingInvites {
|
||||
log::debug!("User {} is in keylock workaround mode ({})", my_pub_id, session.session_id);
|
||||
is_workaround = true;
|
||||
Some(session)
|
||||
} else if let Some(session) = self.games.get_user_game(my_pub_id).await {
|
||||
Some(session)
|
||||
} else {
|
||||
None
|
||||
self.games.get_user_game(my_pub_id).await
|
||||
};
|
||||
if let Some(session) = session {
|
||||
let myself = session.users.iter().find(|u| u.public_id == my_pub_id).unwrap();
|
||||
|
||||
@@ -25,7 +25,7 @@ pub async fn get(id: Path<i32>, query: Query<super::PortQuery>, exporter: Data<I
|
||||
use actix_web::http::header::{ContentDisposition, TryIntoHeaderPair};
|
||||
let ext = exporter.file_ext(&query.plugin).unwrap();
|
||||
// TODO sanitise vehicle name and include it in the filename
|
||||
let dispo = ContentDisposition::attachment(format!("export-{}-{}.{}", &query.plugin, *id, ext));
|
||||
let dispo = ContentDisposition::attachment(format!("export-{}-{}.{}", query.plugin, *id, ext));
|
||||
let (key, val) = dispo.try_into_pair().unwrap();
|
||||
let mut resp = HttpResponse::with_body(StatusCode::OK, export);
|
||||
resp.headers_mut().append(key, val);
|
||||
|
||||
@@ -149,7 +149,7 @@ pub async fn post(form: actix_multipart::form::MultipartForm<ImportForm>, handle
|
||||
}
|
||||
for (i, file) in form.files.iter().enumerate() {
|
||||
#[cfg(debug_assertions)]
|
||||
log::trace!("import {} file {} data: {:?}", &*form.plugin, i, &file.data[..]);
|
||||
log::trace!("import {} file {} data: {:?}", *form.plugin, i, &file.data[..]);
|
||||
let import_data = match importer.import_by_name(&form.plugin, &file.data)
|
||||
.map_err(|e| super::PluginPortError { code: e }) {
|
||||
Ok(x) => x,
|
||||
|
||||
@@ -58,7 +58,7 @@ pub async fn post_remove(auth: Data<Box<oj_rc_core::UserImpl>>, user_opt: Option
|
||||
fedi.defederated.remove(i);
|
||||
user.fedi_set(fedi).await;
|
||||
} else {
|
||||
log::warn!("Failed to find domain {} in defederated list for user {}", &*domain, user.public_id());
|
||||
log::warn!("Failed to find domain {} in defederated list for user {}", *domain, user.public_id());
|
||||
}
|
||||
let resp = Redirect::to("/federation/list")
|
||||
.respond_to(&req)
|
||||
|
||||
Reference in New Issue
Block a user