mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cargo clippy after toolchain-update
This commit is contained in:
parent
394c8892bb
commit
540f0d10f2
@ -76,11 +76,11 @@ pub enum AreaKind {
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref ALIGNMENTS: Vec<String> = vec!["wild", "enemy", "npc", "pet"]
|
||||
static ref ALIGNMENTS: Vec<String> = ["wild", "enemy", "npc", "pet"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
static ref SKILL_TREES: Vec<String> = vec!["general", "sword", "axe", "hammer", "bow", "staff", "sceptre", "mining"]
|
||||
static ref SKILL_TREES: Vec<String> = ["general", "sword", "axe", "hammer", "bow", "staff", "sceptre", "mining"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
@ -128,14 +128,14 @@ lazy_static! {
|
||||
.iter()
|
||||
.map(|o| o.to_string().to_string())
|
||||
.collect();
|
||||
static ref TIMES: Vec<String> = vec![
|
||||
static ref TIMES: Vec<String> = [
|
||||
"midnight", "night", "dawn", "morning", "day", "noon", "dusk"
|
||||
]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
|
||||
static ref WEATHERS: Vec<String> = vec![
|
||||
static ref WEATHERS: Vec<String> = [
|
||||
"clear", "cloudy", "rain", "wind", "storm"
|
||||
]
|
||||
.iter()
|
||||
|
@ -118,18 +118,14 @@ pub fn members<'a>(
|
||||
) -> impl Iterator<Item = (specs::Entity, Role)> + 'a {
|
||||
(entities, groups, alignments, uids)
|
||||
.join()
|
||||
.filter_map(move |(e, g, a, u)| {
|
||||
(*g == group).then(|| {
|
||||
(
|
||||
e,
|
||||
if matches!(a, Alignment::Owned(owner) if owner != u) {
|
||||
Role::Pet
|
||||
} else {
|
||||
Role::Member
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
.filter(move |&(_e, g, _a, _u)| (*g == group)).map(|(e, _g, a, u)| (
|
||||
e,
|
||||
if matches!(a, Alignment::Owned(owner) if owner != u) {
|
||||
Role::Pet
|
||||
} else {
|
||||
Role::Member
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
// TODO: optimize add/remove for massive NPC groups
|
||||
|
@ -123,12 +123,12 @@ impl Hands {
|
||||
|
||||
let mainhand = mainhand
|
||||
.as_ref()
|
||||
.map(|i| from_spec(i))
|
||||
.map(&mut from_spec)
|
||||
.transpose()?
|
||||
.flatten();
|
||||
let offhand = offhand
|
||||
.as_ref()
|
||||
.map(|i| from_spec(i))
|
||||
.map(&mut from_spec)
|
||||
.transpose()?
|
||||
.flatten();
|
||||
Ok((mainhand, offhand))
|
||||
|
@ -649,7 +649,7 @@ impl Inventory {
|
||||
self.get(inv_slot)
|
||||
.and_then(|item| self.loadout.get_slot_to_equip_into(&item.kind()))
|
||||
.map(|equip_slot| self.swap_inventory_loadout(inv_slot, equip_slot, time))
|
||||
.unwrap_or_else(Vec::new)
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Determines how many free inventory slots will be left after equipping an
|
||||
|
@ -1,12 +1,12 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd},
|
||||
fmt, hash,
|
||||
cmp::{Eq, Ord, PartialEq, PartialOrd},
|
||||
fmt,
|
||||
marker::PhantomData,
|
||||
};
|
||||
|
||||
/// Type safe index into Depot
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Id<T> {
|
||||
idx: u32,
|
||||
gen: u32,
|
||||
@ -17,26 +17,6 @@ impl<T> Id<T> {
|
||||
pub fn id(&self) -> u64 { self.idx as u64 | ((self.gen as u64) << 32) }
|
||||
}
|
||||
|
||||
impl<T> Copy for Id<T> {}
|
||||
impl<T> Clone for Id<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
idx: self.idx,
|
||||
gen: self.gen,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T> Eq for Id<T> {}
|
||||
impl<T> PartialEq for Id<T> {
|
||||
fn eq(&self, other: &Self) -> bool { self.idx == other.idx && self.gen == other.gen }
|
||||
}
|
||||
impl<T> Ord for Id<T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering { (self.idx, self.gen).cmp(&(other.idx, other.gen)) }
|
||||
}
|
||||
impl<T> PartialOrd for Id<T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
|
||||
}
|
||||
impl<T> fmt::Debug for Id<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
@ -48,12 +28,6 @@ impl<T> fmt::Debug for Id<T> {
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<T> hash::Hash for Id<T> {
|
||||
fn hash<H: hash::Hasher>(&self, h: &mut H) {
|
||||
self.idx.hash(h);
|
||||
self.gen.hash(h);
|
||||
}
|
||||
}
|
||||
|
||||
struct Entry<T> {
|
||||
gen: u32,
|
||||
|
@ -176,7 +176,7 @@ impl MapSizeLg {
|
||||
map_size_lg.y + TERRAIN_CHUNK_BLOCKS_LG < 32;
|
||||
// Assertion on dimensions: product of dimensions must fit in a usize.
|
||||
let chunks_product_in_range =
|
||||
matches!(1usize.checked_shl(map_size_lg.x + map_size_lg.y), Some(_));
|
||||
1usize.checked_shl(map_size_lg.x + map_size_lg.y).is_some();
|
||||
if blocks_in_range && chunks_product_in_range {
|
||||
// Cleared all invariants.
|
||||
Ok(MapSizeLg(map_size_lg))
|
||||
|
@ -178,7 +178,7 @@ impl<T: Event> PreparedEventQuery<T> {
|
||||
Ok(Self {
|
||||
bytes: bincode::serialize(&event).map_err(PluginError::Encoding)?,
|
||||
function_name: event.get_event_name(),
|
||||
_phantom: PhantomData::default(),
|
||||
_phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ pub enum ProtocolsError {
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
//// TCP
|
||||
// TCP
|
||||
#[derive(Debug)]
|
||||
pub struct TcpDrain {
|
||||
half: OwnedWriteHalf,
|
||||
@ -546,7 +546,7 @@ impl UnreliableSink for TcpSink {
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
//// MPSC
|
||||
// MPSC
|
||||
#[derive(Debug)]
|
||||
pub struct MpscDrain {
|
||||
sender: mpsc::Sender<MpscMsg>,
|
||||
@ -584,7 +584,7 @@ impl UnreliableSink for MpscSink {
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
//// QUIC
|
||||
// QUIC
|
||||
#[cfg(feature = "quic")]
|
||||
type QuicStream = (
|
||||
BytesMut,
|
||||
|
@ -456,7 +456,6 @@ impl BParticipant {
|
||||
let retrigger = |cid: Cid, mut p: RecvProtocols, map: &mut HashMap<_, _>| {
|
||||
let hacky_recv_s = hacky_recv_s.clone();
|
||||
let handle = tokio::spawn(async move {
|
||||
let cid = cid;
|
||||
let r = p.recv().await;
|
||||
let _ = hacky_recv_s.send((cid, r, p)); // ignoring failed
|
||||
});
|
||||
|
@ -27,7 +27,6 @@ impl<T: Eq + Hash> DeferredTracer<T> {
|
||||
*self.items.entry(t).or_default() += 1;
|
||||
self.last = Instant::now();
|
||||
self.last_cnt += 1;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,6 @@ impl Animation for AlphaAnimation {
|
||||
Quaternion::rotation_y(-0.2 + move1 * -0.3) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation =
|
||||
Quaternion::rotation_y(0.2 + move1 * 0.3) * Quaternion::rotation_z(-0.2);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -137,7 +137,6 @@ impl Animation for ComboAnimation {
|
||||
* Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.2 + move1 * 0.3)
|
||||
* Quaternion::rotation_z(-0.2);
|
||||
} else {
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
|
@ -88,7 +88,6 @@ impl Animation for ShockwaveAnimation {
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.0);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -79,7 +79,6 @@ impl Animation for ShootAnimation {
|
||||
|
||||
next.foot_l.orientation = Quaternion::rotation_x(movement1abs * 0.3);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(movement1abs * 0.3);
|
||||
} else {
|
||||
}
|
||||
if velocity.xy().magnitude() < 1.0 {
|
||||
next.wing_in_l.orientation = Quaternion::rotation_y(-1.0 + movement1abs * 0.8)
|
||||
|
@ -103,7 +103,6 @@ impl Animation for SummonAnimation {
|
||||
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
|
||||
next.tail_rear.orientation =
|
||||
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -83,7 +83,6 @@ impl Animation for AlphaAnimation {
|
||||
Quaternion::rotation_y(-0.2 + move1 * -0.3) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation =
|
||||
Quaternion::rotation_y(0.2 + move1 * 0.3) * Quaternion::rotation_z(-0.2);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -68,7 +68,6 @@ impl Animation for ShockwaveAnimation {
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -66,7 +66,6 @@ impl Animation for ShootAnimation {
|
||||
|
||||
next.leg_l.orientation = Quaternion::rotation_x(movement1abs * -0.5);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(movement1abs * -0.5);
|
||||
} else {
|
||||
}
|
||||
if velocity.xy().magnitude() < 1.0 {
|
||||
next.wing_in_l.orientation = Quaternion::rotation_y(-1.0 + movement1abs * 0.8)
|
||||
|
@ -84,7 +84,6 @@ impl Animation for SummonAnimation {
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||
next.tail.orientation =
|
||||
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
|
||||
} else {
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -105,7 +105,6 @@ impl Animation for BeamAnimation {
|
||||
Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
_ => {},
|
||||
|
@ -84,7 +84,6 @@ impl Animation for RepeaterAnimation {
|
||||
* Quaternion::rotation_z(move1 * -0.6 + move3 * 0.8);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||
} else {
|
||||
};
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + move1 * 2.0, s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.2 + move3 * 0.2);
|
||||
|
@ -218,7 +218,6 @@ impl Animation for SneakWieldAnimation {
|
||||
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
|
||||
} else {
|
||||
}
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||
next.hand_l.orientation =
|
||||
|
@ -208,7 +208,6 @@ impl Animation for WieldAnimation {
|
||||
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
|
||||
} else {
|
||||
}
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||
next.hand_l.orientation =
|
||||
|
@ -73,7 +73,6 @@ impl Animation for ShockwaveAnimation {
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + move2);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + move2);
|
||||
} else {
|
||||
}
|
||||
next
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ impl Animation for BreatheAnimation {
|
||||
next.foot_bl.orientation = Quaternion::rotation_y(twitch2 * 0.02);
|
||||
|
||||
next.foot_br.orientation = Quaternion::rotation_y(twitch2 * 0.02);
|
||||
} else {
|
||||
};
|
||||
next
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ impl Animation for ShootAnimation {
|
||||
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
|
||||
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
Some("common.abilities.custom.dagon.dagonbombs") => {
|
||||
@ -117,7 +116,6 @@ impl Animation for ShootAnimation {
|
||||
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
|
||||
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
_ => {
|
||||
@ -150,7 +148,6 @@ impl Animation for ShootAnimation {
|
||||
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
|
||||
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user