mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix clippy issues, WITHOUT clippy::needless_pass_by_ref_mut as we are still unsure how to proceed with it. we want to keep the &mut ref where we are actually writing. maybe we need another method support
This commit is contained in:
parent
882a8d104c
commit
631f3ab8ee
@ -16,7 +16,7 @@ impl<T> Id<T> {
|
||||
|
||||
impl<T> Copy for Id<T> {}
|
||||
impl<T> Clone for Id<T> {
|
||||
fn clone(&self) -> Self { Self(self.0, PhantomData) }
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
impl<T> Eq for Id<T> {}
|
||||
impl<T> PartialEq for Id<T> {
|
||||
|
@ -1,3 +1,7 @@
|
||||
#![allow(
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
|
||||
use clap::Parser;
|
||||
use common::comp;
|
||||
use server::persistence::SqlLogMode;
|
||||
|
@ -2924,11 +2924,7 @@ impl<'a> AgentData<'a> {
|
||||
{
|
||||
agent.action_state.counters[FCounters::SummonThreshold as usize] -=
|
||||
SUMMON_THRESHOLD;
|
||||
if !agent.action_state.conditions[Conditions::AttackToggle as usize] {
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = true;
|
||||
} else {
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = false;
|
||||
}
|
||||
agent.action_state.conditions[Conditions::AttackToggle as usize] = !agent.action_state.conditions[Conditions::AttackToggle as usize];
|
||||
}
|
||||
} else {
|
||||
// If target is in melee range use flamecrush
|
||||
|
@ -1,4 +1,7 @@
|
||||
#![feature(exclusive_range_pattern, let_chains)]
|
||||
#![allow(
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
|
||||
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
|
||||
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
|
||||
|
@ -1,5 +1,8 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![allow(clippy::option_map_unit_fn)]
|
||||
#![allow(
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![feature(
|
||||
box_patterns,
|
||||
|
@ -1062,7 +1062,7 @@ pub fn update(
|
||||
// The `defer_foreign_keys` pragma treats the foreign key
|
||||
// constraints as deferred for the next transaction (it turns itself
|
||||
// off at the commit boundary). https://sqlite.org/foreignkeys.html#fk_deferred
|
||||
transaction.pragma_update(None, "defer_foreign_keys", &"ON".to_string())?;
|
||||
transaction.pragma_update(None, "defer_foreign_keys", "ON")?;
|
||||
|
||||
let mut stmt = transaction.prepare_cached(
|
||||
"
|
||||
|
@ -1,4 +1,7 @@
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![allow(
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
|
||||
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
|
||||
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
|
||||
|
@ -407,7 +407,7 @@ impl TabComplete for ArgumentSpec {
|
||||
.filter(|string| string.starts_with(part))
|
||||
.map(|c| c.to_string())
|
||||
.collect(),
|
||||
ArgumentSpec::Boolean(_, part, _) => vec!["true", "false"]
|
||||
ArgumentSpec::Boolean(_, part, _) => ["true", "false"]
|
||||
.iter()
|
||||
.filter(|string| string.starts_with(part))
|
||||
.map(|c| c.to_string())
|
||||
|
@ -196,7 +196,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
.set(self.bg_ids.bg_frame, ui);
|
||||
}
|
||||
|
||||
fn title(&mut self, state: &mut ConrodState<'_, InventoryScrollerState>, ui: &mut UiCell<'_>) {
|
||||
fn title(&mut self, state: &ConrodState<'_, InventoryScrollerState>, ui: &mut UiCell<'_>) {
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
@ -371,7 +371,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
});
|
||||
}
|
||||
for (pos, item) in items.into_iter() {
|
||||
if self.details_mode && !self.is_us && matches!(item, None) {
|
||||
if self.details_mode && !self.is_us && item.is_none() {
|
||||
continue;
|
||||
}
|
||||
let (x, y) = if self.details_mode {
|
||||
@ -488,7 +488,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
|
||||
fn footer_metrics(
|
||||
&mut self,
|
||||
state: &mut ConrodState<'_, InventoryScrollerState>,
|
||||
state: &ConrodState<'_, InventoryScrollerState>,
|
||||
ui: &mut UiCell<'_>,
|
||||
) {
|
||||
let space_used = self.inventory.populated_slots();
|
||||
|
@ -1479,7 +1479,7 @@ impl<'a> Widget for Crafting<'a> {
|
||||
});
|
||||
self.inventory
|
||||
.slots_with_id()
|
||||
.filter(|(_, item)| item.as_ref().map_or(false, |i| can_repair(i)))
|
||||
.filter(|(_, item)| item.as_ref().map_or(false, can_repair))
|
||||
.for_each(|(slot, _)| {
|
||||
events.push(Event::RepairItem {
|
||||
slot: Slot::Inventory(slot),
|
||||
@ -1489,7 +1489,7 @@ impl<'a> Widget for Crafting<'a> {
|
||||
|
||||
let can_perform = repair_slot
|
||||
.item(self.inventory)
|
||||
.map_or(false, |item| can_repair(item));
|
||||
.map_or(false, can_repair);
|
||||
|
||||
(repair_slot.slot, None, can_perform)
|
||||
},
|
||||
|
@ -516,30 +516,28 @@ impl BuffIconKind {
|
||||
|
||||
impl PartialOrd for BuffIconKind {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for BuffIconKind {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
match (self, other) {
|
||||
(
|
||||
BuffIconKind::Buff { kind, .. },
|
||||
BuffIconKind::Buff {
|
||||
kind: other_kind, ..
|
||||
},
|
||||
) => Some(kind.cmp(other_kind)),
|
||||
(BuffIconKind::Buff { .. }, BuffIconKind::Stance(_)) => Some(Ordering::Greater),
|
||||
(BuffIconKind::Stance(_), BuffIconKind::Buff { .. }) => Some(Ordering::Less),
|
||||
) => kind.cmp(other_kind),
|
||||
(BuffIconKind::Buff { .. }, BuffIconKind::Stance(_)) => Ordering::Greater,
|
||||
(BuffIconKind::Stance(_), BuffIconKind::Buff { .. }) => Ordering::Less,
|
||||
(BuffIconKind::Stance(stance), BuffIconKind::Stance(stance_other)) => {
|
||||
Some(stance.cmp(stance_other))
|
||||
stance.cmp(stance_other)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for BuffIconKind {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
// We know this is safe since we can look at the partialord implementation and
|
||||
// see that every variant is wrapped in Some
|
||||
self.partial_cmp(other).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for BuffIconKind {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
@ -586,7 +584,7 @@ impl BuffIcon {
|
||||
buffs
|
||||
.iter_active()
|
||||
.filter_map(BuffIcon::from_buffs)
|
||||
.chain(stance.and_then(BuffIcon::from_stance).into_iter())
|
||||
.chain(stance.and_then(BuffIcon::from_stance))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ impl<'a> Widget for Quest<'a> {
|
||||
// [amount, item_desc]
|
||||
|
||||
//("common.items.weapons.sword.caladbolg");
|
||||
let rewards = vec![
|
||||
let rewards = [
|
||||
(1, "common.items.weapons.dagger.starter_dagger", "Dagger"),
|
||||
(4, "common.items.crafting_ing.seashells", "Seashell"),
|
||||
(
|
||||
|
@ -1,6 +1,10 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(clippy::identity_op, clippy::option_map_unit_fn)]
|
||||
#![allow(
|
||||
clippy::identity_op,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![feature(
|
||||
array_methods,
|
||||
|
@ -529,8 +529,8 @@ pub fn generate_mesh<'a>(
|
||||
(
|
||||
opaque_deep
|
||||
.into_iter()
|
||||
.chain(opaque_shallow.into_iter())
|
||||
.chain(opaque_surface.into_iter())
|
||||
.chain(opaque_shallow)
|
||||
.chain(opaque_surface)
|
||||
.collect(),
|
||||
fluid_mesh,
|
||||
Mesh::new(),
|
||||
|
@ -1069,7 +1069,7 @@ fn mesh_hold() -> BoneMeshes {
|
||||
)
|
||||
}
|
||||
|
||||
/////////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct QuadrupedSmallCentralSpec(HashMap<(QSSpecies, QSBodyType), SidedQSCentralVoxSpec>);
|
||||
|
||||
@ -1660,7 +1660,7 @@ impl QuadrupedMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BirdMediumCentralSpec(HashMap<(BMSpecies, BMBodyType), SidedBMCentralVoxSpec>);
|
||||
|
||||
@ -1914,7 +1914,7 @@ impl BirdMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct TheropodCentralSpec(HashMap<(TSpecies, TBodyType), SidedTCentralVoxSpec>);
|
||||
|
||||
@ -2244,7 +2244,7 @@ impl TheropodLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct ArthropodCentralSpec(HashMap<(ASpecies, ABodyType), SidedACentralVoxSpec>);
|
||||
|
||||
@ -2644,7 +2644,7 @@ impl ArthropodLateralSpec {
|
||||
(lateral, Vec3::from(spec.leg_br.offset))
|
||||
}
|
||||
}
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct FishMediumCentralSpec(HashMap<(FMSpecies, FMBodyType), SidedFMCentralVoxSpec>);
|
||||
|
||||
@ -2850,7 +2850,7 @@ impl FishMediumLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct FishSmallCentralSpec(HashMap<(FSSpecies, FSBodyType), SidedFSCentralVoxSpec>);
|
||||
|
||||
@ -2994,7 +2994,7 @@ impl FishSmallLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct BipedSmallWeaponSpec(HashMap<ToolKey, ArmorVoxSpec>);
|
||||
@ -3269,8 +3269,8 @@ impl BipedSmallWeaponSpec {
|
||||
(tool_kind_segment, offset)
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct DragonCentralSpec(HashMap<(DSpecies, DBodyType), SidedDCentralVoxSpec>);
|
||||
|
||||
@ -3641,7 +3641,7 @@ impl DragonLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BirdLargeCentralSpec(HashMap<(BLASpecies, BLABodyType), SidedBLACentralVoxSpec>);
|
||||
|
||||
@ -4044,7 +4044,7 @@ impl BirdLargeLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct BipedLargeCentralSpec(HashMap<(BLSpecies, BLBodyType), SidedBLCentralVoxSpec>);
|
||||
|
||||
@ -4462,7 +4462,8 @@ impl BipedLargeSecondSpec {
|
||||
(tool_kind_segment, offset)
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct GolemCentralSpec(HashMap<(GSpecies, GBodyType), SidedGCentralVoxSpec>);
|
||||
|
||||
@ -4772,8 +4773,7 @@ impl GolemLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct QuadrupedLowCentralSpec(HashMap<(QLSpecies, QLBodyType), SidedQLCentralVoxSpec>);
|
||||
|
||||
@ -5050,8 +5050,7 @@ impl QuadrupedLowLateralSpec {
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
//////
|
||||
#[derive(Deserialize)]
|
||||
struct ObjectCentralSpec(HashMap<object::Body, SidedObjectCentralVoxSpec>);
|
||||
|
||||
|
@ -1101,8 +1101,8 @@ impl FigureMgr {
|
||||
let holding_lantern = inventory
|
||||
.map_or(false, |i| i.equipped(EquipSlot::Lantern).is_some())
|
||||
&& light_emitter.is_some()
|
||||
&& !((matches!(second_tool_hand, Some(_))
|
||||
|| matches!(active_tool_hand, Some(Hands::Two)))
|
||||
&& !(second_tool_hand.is_some()
|
||||
|| matches!(active_tool_hand, Some(Hands::Two))
|
||||
&& character.map_or(false, |c| c.is_wield()))
|
||||
&& !character.map_or(false, |c| c.is_using_hands())
|
||||
&& physics.in_liquid().is_none();
|
||||
|
@ -137,7 +137,7 @@ impl Scene {
|
||||
figure_state: None,
|
||||
|
||||
backdrop: backdrop.map(|specifier| {
|
||||
let mut state = FigureState::new(renderer, FixtureSkeleton::default(), ());
|
||||
let mut state = FigureState::new(renderer, FixtureSkeleton, ());
|
||||
let mut greedy = FigureModel::make_greedy();
|
||||
let mut opaque_mesh = Mesh::new();
|
||||
let (segment, offset) = load_mesh(specifier, Vec3::new(-55.0, -49.5, -2.0));
|
||||
|
@ -437,8 +437,8 @@ fn mesh_worker(
|
||||
(
|
||||
deep_level
|
||||
.into_iter()
|
||||
.chain(shallow_level.into_iter())
|
||||
.chain(surface_level.into_iter())
|
||||
.chain(shallow_level)
|
||||
.chain(surface_level)
|
||||
.collect(),
|
||||
alt_indices,
|
||||
)
|
||||
|
@ -59,7 +59,7 @@ impl Interactable {
|
||||
volume_pos: VolumePos,
|
||||
interaction: Interaction,
|
||||
) -> Option<Self> {
|
||||
let Some(block) = volume_pos.get_block(terrain, id_maps, colliders) else { return None };
|
||||
let block= volume_pos.get_block(terrain, id_maps, colliders)?;
|
||||
let block_interaction = match interaction {
|
||||
Interaction::Collect => {
|
||||
// Check if this is an unlockable sprite
|
||||
|
@ -5,7 +5,7 @@ mod widget;
|
||||
|
||||
pub use defaults::Defaults;
|
||||
|
||||
pub(self) use primitive::Primitive;
|
||||
use primitive::Primitive;
|
||||
|
||||
use super::{
|
||||
super::graphic::{self, Graphic, TexId},
|
||||
|
@ -675,6 +675,7 @@ impl Window {
|
||||
.game_analog_button_map
|
||||
.get(&AnalogButton::from((button, code)))
|
||||
{
|
||||
#[allow(clippy::never_loop)]
|
||||
for action in actions {
|
||||
match *action {}
|
||||
}
|
||||
@ -684,6 +685,7 @@ impl Window {
|
||||
.menu_analog_button_map
|
||||
.get(&AnalogButton::from((button, code)))
|
||||
{
|
||||
#[allow(clippy::never_loop)]
|
||||
for action in actions {
|
||||
match *action {}
|
||||
}
|
||||
|
@ -1036,7 +1036,6 @@ pub fn apply_caverns_to<R: Rng>(canvas: &mut Canvas, dynamic_rng: &mut R) {
|
||||
}
|
||||
};
|
||||
|
||||
let cavern_top = cavern_top;
|
||||
let mut last_kind = BlockKind::Rock;
|
||||
for z in cavern_bottom - 1..cavern_top {
|
||||
use SpriteKind::*;
|
||||
|
@ -2,7 +2,8 @@
|
||||
#![allow(
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::blocks_in_if_conditions,
|
||||
clippy::identity_op
|
||||
clippy::identity_op,
|
||||
clippy::needless_pass_by_ref_mut //until we find a better way for specs
|
||||
)]
|
||||
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
|
@ -31,7 +31,7 @@ impl<'a, R: Rng> NameGen<'a, R> {
|
||||
]);
|
||||
let mut middle = cons.clone();
|
||||
middle.extend(vec!["tt"]);
|
||||
let vowel = vec!["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let vowel = ["o", "e", "a", "i", "u", "au", "ee", "ow", "ay", "ey", "oe"];
|
||||
let end = vec![
|
||||
"et", "ige", "age", "ist", "en", "on", "og", "end", "ind", "ock", "een", "edge", "ist",
|
||||
"ed", "est", "eed", "ast", "olt", "ey", "ean", "ead", "onk", "ink", "eon", "er", "ow",
|
||||
|
@ -641,7 +641,7 @@ impl Archetype for House {
|
||||
% 6
|
||||
{
|
||||
0 => SpriteKind::HangingSign,
|
||||
1 | 2 | 3 => SpriteKind::HangingBasket,
|
||||
1..=3 => SpriteKind::HangingBasket,
|
||||
4 => SpriteKind::WallSconce,
|
||||
5 => SpriteKind::WallLampSmall,
|
||||
_ => SpriteKind::DungeonWallDecor,
|
||||
|
@ -1414,7 +1414,7 @@ impl Land {
|
||||
}
|
||||
}
|
||||
|
||||
closed.into_iter().chain(open.into_iter()).collect()
|
||||
closed.into_iter().chain(open).collect()
|
||||
}
|
||||
|
||||
fn write_path(
|
||||
|
@ -298,7 +298,7 @@ impl GnarlingFortification {
|
||||
wall_connections
|
||||
.iter()
|
||||
.copied()
|
||||
.zip(inner_tower_locs.into_iter()),
|
||||
.zip(inner_tower_locs),
|
||||
)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@ -454,7 +454,6 @@ impl Structure for GnarlingFortification {
|
||||
})
|
||||
.for_each(|(point, next_point)| {
|
||||
// 2d world positions of each point in wall segment
|
||||
let point = point;
|
||||
let start_wpos = point + self.origin;
|
||||
let end_wpos = next_point + self.origin;
|
||||
|
||||
@ -1829,7 +1828,7 @@ impl Structure for GnarlingFortification {
|
||||
}
|
||||
tunnels
|
||||
.into_iter()
|
||||
.chain(rooms.into_iter())
|
||||
.chain(rooms)
|
||||
.chain(core::iter::once(boss_room))
|
||||
.chain(core::iter::once(stump))
|
||||
.for_each(|prim| prim.fill(wood.clone()));
|
||||
@ -1839,7 +1838,7 @@ impl Structure for GnarlingFortification {
|
||||
let mut sprite_clear = Vec::new();
|
||||
tunnels_clear
|
||||
.into_iter()
|
||||
.chain(rooms_clear.into_iter())
|
||||
.chain(rooms_clear)
|
||||
.chain(core::iter::once(boss_room_clear))
|
||||
.for_each(|prim| {
|
||||
sprite_clear.push(prim.translate(Vec3::new(0, 0, 1)).intersect(prim));
|
||||
|
Loading…
Reference in New Issue
Block a user