mirror of
https://gitlab.com/veloren/veloren
synced 2026-08-16 16:26:07 -04:00
Suppress two clippy lints and revert some of their changes from the last
toolchain update. The lints are `collapsible_match` and `manual_option_zip`. `collapsible_match` made the match arms inconsistent and made them reliant on being followed by a no-op wildcard arm. `manual_option_zip` has a bug in our current version where it suggests transforming conditional calls into unconditional calls.
This commit is contained in:
parent
91c34392da
commit
283306780d
15 changed files with 123 additions and 68 deletions
13
Cargo.toml
13
Cargo.toml
|
|
@ -45,6 +45,16 @@ rust.tail_expr_drop_order = { level = "allow", priority = 1 }
|
|||
rust.edition_2024_expr_fragment_specifier = { level = "allow", priority = 1 }
|
||||
rust.keyword_idents_2024 = { level = "allow", priority = 1 }
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# This lint is widely considered an annoyance by Veloren developers and doesn't pay its way.
|
||||
unnecessary_map_or = "allow"
|
||||
# This suggests turning if statements into if guards in the match. This is
|
||||
# often not ideal because this can make the match arms inconsistent and make
|
||||
# them reliant on being followed by a no-op wildcard arm.
|
||||
collapsible_match = "allow"
|
||||
# bug in current version (fixed in latest nightly)
|
||||
manual_option_zip = "allow"
|
||||
|
||||
### PROFILES ###
|
||||
|
||||
# default profile for devs, fast to compile, okay enough to run, no debug information
|
||||
|
|
@ -240,6 +250,3 @@ specs = { git = "https://github.com/amethyst/specs.git", rev = "4e2da1df29ee840b
|
|||
# naga = { path = "../wgpu/naga" }
|
||||
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# This lint is widely considered an annoyance by Veloren developers and doesn't pay its way.
|
||||
unnecessary_map_or = "allow"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ pub struct QueryServer {
|
|||
#[derive(Default, Clone, Copy, Debug)]
|
||||
pub struct Metrics {
|
||||
pub received_packets: u32,
|
||||
/// Note, these are not counted in `received_packets`.
|
||||
pub dropped_packets: u32,
|
||||
pub invalid_packets: u32,
|
||||
pub proccessing_errors: u32,
|
||||
|
|
|
|||
|
|
@ -1115,16 +1115,17 @@ impl Inventory {
|
|||
);
|
||||
}
|
||||
},
|
||||
EquipSlot::InactiveMainhand
|
||||
EquipSlot::InactiveMainhand => {
|
||||
if self.loadout.equipped(EquipSlot::InactiveMainhand).is_none()
|
||||
&& self.loadout.equipped(EquipSlot::InactiveOffhand).is_some() =>
|
||||
{
|
||||
let offhand = self.loadout.swap(EquipSlot::InactiveOffhand, None, time);
|
||||
assert!(
|
||||
self.loadout
|
||||
.swap(EquipSlot::InactiveMainhand, offhand, time)
|
||||
.is_none()
|
||||
);
|
||||
&& self.loadout.equipped(EquipSlot::InactiveOffhand).is_some()
|
||||
{
|
||||
let offhand = self.loadout.swap(EquipSlot::InactiveOffhand, None, time);
|
||||
assert!(
|
||||
self.loadout
|
||||
.swap(EquipSlot::InactiveMainhand, offhand, time)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,8 +166,10 @@ impl CharacterBehavior for Data {
|
|||
c.timer = tick_attack_or_default(data, self.timer, None);
|
||||
}
|
||||
},
|
||||
StageSection::Recover if self.timer < self.static_data.recover_duration => {
|
||||
if let CharacterState::LeapRanged(c) = &mut update.character {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration
|
||||
&& let CharacterState::LeapRanged(c) = &mut update.character
|
||||
{
|
||||
c.timer = tick_attack_or_default(data, self.timer, None);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ impl<'a> System<'a> for Sys {
|
|||
read_data
|
||||
.positions
|
||||
.get(target)
|
||||
.zip(read_data.healths.get(target))
|
||||
.zip(read_data.uids.get(target))
|
||||
.zip(read_data.bodies.get(target))
|
||||
.and_then(|l| read_data.healths.get(target).map(|r| (l, r)))
|
||||
.and_then(|l| read_data.uids.get(target).map(|r| (l, r)))
|
||||
.and_then(|l| read_data.bodies.get(target).map(|r| (l, r)))
|
||||
.map(|(((pos_b, health_b), uid_b), body_b)| {
|
||||
(target, uid_b, pos_b, health_b, body_b)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -199,10 +199,12 @@ where
|
|||
self.reliable_buffers.insert(sid, BytesMut::new());
|
||||
}
|
||||
},
|
||||
ProtocolEvent::CloseStream { sid } if !self.store.try_close_stream(sid) => {
|
||||
#[cfg(feature = "trace_pedantic")]
|
||||
trace!(?sid, "hold back notify close stream");
|
||||
self.notify_closing_streams.push(sid);
|
||||
ProtocolEvent::CloseStream { sid } => {
|
||||
if !self.store.try_close_stream(sid) {
|
||||
#[cfg(feature = "trace_pedantic")]
|
||||
trace!(?sid, "hold back notify close stream");
|
||||
self.notify_closing_streams.push(sid);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,10 +113,12 @@ where
|
|||
self.store
|
||||
.open_stream(sid, prio, promises, guaranteed_bandwidth);
|
||||
},
|
||||
ProtocolEvent::CloseStream { sid } if !self.store.try_close_stream(sid) => {
|
||||
#[cfg(feature = "trace_pedantic")]
|
||||
trace!(?sid, "hold back notify close stream");
|
||||
self.notify_closing_streams.push(sid);
|
||||
ProtocolEvent::CloseStream { sid } => {
|
||||
if !self.store.try_close_stream(sid) {
|
||||
#[cfg(feature = "trace_pedantic")]
|
||||
trace!(?sid, "hold back notify close stream");
|
||||
self.notify_closing_streams.push(sid);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8204,15 +8204,18 @@ impl AgentData<'_> {
|
|||
false
|
||||
}
|
||||
},
|
||||
Some(input @ InputKind::Ability(1))
|
||||
Some(input @ InputKind::Ability(1)) => {
|
||||
if self
|
||||
.char_state
|
||||
.timer()
|
||||
.is_some_and(|t| t.as_secs_f32() < 3.0)
|
||||
&& could_use_input(input) =>
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
true
|
||||
&& could_use_input(input)
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
_ => false,
|
||||
};
|
||||
|
|
@ -8301,22 +8304,25 @@ impl AgentData<'_> {
|
|||
controller.push_basic_input(input);
|
||||
}
|
||||
},
|
||||
CharacterState::ChargedRanged(c)
|
||||
if c.charge_frac() < 1.0 && could_use_input(input) =>
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
CharacterState::ChargedRanged(c) => {
|
||||
if c.charge_frac() < 1.0 && could_use_input(input) {
|
||||
controller.push_basic_input(input);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
let continued_attack = match self.char_state.ability_info().map(|ai| ai.input) {
|
||||
Some(input @ InputKind::Primary)
|
||||
Some(input @ InputKind::Primary) => {
|
||||
if !matches!(self.char_state.stage_section(), Some(StageSection::Recover))
|
||||
&& could_use_input(input) =>
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
true
|
||||
&& could_use_input(input)
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
_ => false,
|
||||
};
|
||||
|
|
@ -8452,10 +8458,10 @@ impl AgentData<'_> {
|
|||
controller.push_basic_input(input);
|
||||
}
|
||||
},
|
||||
CharacterState::ChargedRanged(c)
|
||||
if c.charge_frac() < 1.0 && could_use_input(input) =>
|
||||
{
|
||||
controller.push_basic_input(input);
|
||||
CharacterState::ChargedRanged(c) => {
|
||||
if c.charge_frac() < 1.0 && could_use_input(input) {
|
||||
controller.push_basic_input(input);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,9 +211,13 @@ pub fn handle_create_npc(server: &mut Server, ev: CreateNpcEvent) -> EcsEntity {
|
|||
&state.ecs().read_storage(),
|
||||
&uids,
|
||||
&mut |entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
// Might be unnecessary, but maybe pets can somehow have map
|
||||
// markers in the future
|
||||
|
|
|
|||
|
|
@ -1672,7 +1672,9 @@ impl ServerEvent for ExplosionEvent {
|
|||
.filter_map(|entity| {
|
||||
data.auras
|
||||
.get(entity)
|
||||
.zip(data.positions.get(entity))
|
||||
.and_then(|entity_auras| {
|
||||
data.positions.get(entity).map(|pos| (entity_auras, pos))
|
||||
})
|
||||
.and_then(|(entity_auras, pos)| {
|
||||
entity_auras
|
||||
.auras
|
||||
|
|
@ -1807,7 +1809,9 @@ impl ServerEvent for ExplosionEvent {
|
|||
.filter_map(|entity| {
|
||||
data.auras
|
||||
.get(entity)
|
||||
.zip(data.positions.get(entity))
|
||||
.and_then(|entity_auras| {
|
||||
data.positions.get(entity).map(|pos| (entity_auras, pos))
|
||||
})
|
||||
.and_then(|(entity_auras, pos)| {
|
||||
entity_auras
|
||||
.auras
|
||||
|
|
|
|||
|
|
@ -141,9 +141,13 @@ impl ServerEvent for GroupManipEvent {
|
|||
&uids,
|
||||
&entities,
|
||||
&mut |entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
update_map_markers(&map_markers, &uids, c, &group_change);
|
||||
c.send_fallible(ServerGeneral::GroupUpdate(g));
|
||||
|
|
@ -204,9 +208,13 @@ impl ServerEvent for GroupManipEvent {
|
|||
&uids,
|
||||
&entities,
|
||||
&mut |entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
update_map_markers(
|
||||
&map_markers,
|
||||
|
|
@ -291,9 +299,13 @@ impl ServerEvent for GroupManipEvent {
|
|||
&alignments,
|
||||
&uids,
|
||||
|entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
update_map_markers(
|
||||
&map_markers,
|
||||
|
|
|
|||
|
|
@ -272,9 +272,13 @@ pub fn handle_invite_accept(data: &mut InviteResponseData, entity: Entity) {
|
|||
&data.alignments,
|
||||
&data.uids,
|
||||
|entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| data.uids.get(*e).copied())
|
||||
.zip(data.clients.get(entity))
|
||||
data.clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| data.uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
update_map_markers(&data.map_markers, &data.uids, c, &group_change);
|
||||
c.send_fallible(ServerGeneral::GroupUpdate(g));
|
||||
|
|
|
|||
|
|
@ -100,9 +100,13 @@ fn tame_pet_internal(ecs: &specs::World, pet_entity: Entity, owner: Entity, pet:
|
|||
&ecs.read_storage(),
|
||||
&uids,
|
||||
&mut |entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
// Might be unneccessary, but maybe pets can somehow have map
|
||||
// markers in the future
|
||||
|
|
|
|||
|
|
@ -1238,9 +1238,13 @@ impl StateExt for State {
|
|||
&uids,
|
||||
&self.ecs().entities(),
|
||||
&mut |entity, group_change| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.zip(clients.get(entity))
|
||||
clients
|
||||
.get(entity)
|
||||
.and_then(|c| {
|
||||
group_change
|
||||
.try_map_ref(|e| uids.get(*e).copied())
|
||||
.map(|g| (g, c))
|
||||
})
|
||||
.map(|(g, c)| {
|
||||
update_map_markers(&map_markers, &uids, c, &group_change);
|
||||
c.send_fallible(ServerGeneral::GroupUpdate(g));
|
||||
|
|
|
|||
|
|
@ -449,8 +449,10 @@ impl TutorialState {
|
|||
Interactable::Entity {
|
||||
interaction: EntityInteraction::CampfireSit,
|
||||
..
|
||||
} if self.earn_achievement(Achievement::FindCampfire) => {
|
||||
self.show_hint(Hint::Campfire, Duration::from_secs(1));
|
||||
} => {
|
||||
if self.earn_achievement(Achievement::FindCampfire) {
|
||||
self.show_hint(Hint::Campfire, Duration::from_secs(1));
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue