mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xMAC94x/update-toolchain' into 'master'
fix master / update toolchain to `2020-08-15` See merge request veloren/veloren!1302
This commit is contained in:
commit
6d2c4b9c1a
@ -43,10 +43,7 @@ impl Alignment {
|
||||
|
||||
// TODO: Remove this hack
|
||||
pub fn is_friendly_to_players(&self) -> bool {
|
||||
match self {
|
||||
Alignment::Npc | Alignment::Tame | Alignment::Owned(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Alignment::Npc | Alignment::Tame | Alignment::Owned(_))
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,19 +126,9 @@ pub enum Activity {
|
||||
}
|
||||
|
||||
impl Activity {
|
||||
pub fn is_follow(&self) -> bool {
|
||||
match self {
|
||||
Activity::Follow { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_follow(&self) -> bool { matches!(self, Activity::Follow { .. }) }
|
||||
|
||||
pub fn is_attack(&self) -> bool {
|
||||
match self {
|
||||
Activity::Attack { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_attack(&self) -> bool { matches!(self, Activity::Attack { .. }) }
|
||||
}
|
||||
|
||||
impl Default for Activity {
|
||||
|
@ -100,12 +100,7 @@ impl<
|
||||
}
|
||||
|
||||
impl Body {
|
||||
pub fn is_humanoid(&self) -> bool {
|
||||
match self {
|
||||
Body::Humanoid(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_humanoid(&self) -> bool { matches!(self, Body::Humanoid(_)) }
|
||||
|
||||
// Note: this might need to be refined to something more complex for realistic
|
||||
// behavior with less cylindrical bodies (e.g. wolfs)
|
||||
|
@ -73,7 +73,7 @@ pub enum CharacterState {
|
||||
|
||||
impl CharacterState {
|
||||
pub fn is_wield(&self) -> bool {
|
||||
match self {
|
||||
matches!(self,
|
||||
CharacterState::Wielding
|
||||
| CharacterState::BasicMelee(_)
|
||||
| CharacterState::BasicRanged(_)
|
||||
@ -82,50 +82,34 @@ impl CharacterState {
|
||||
| CharacterState::BasicBlock
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::SpinMelee(_)
|
||||
| CharacterState::ChargedRanged(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
| CharacterState::ChargedRanged(_))
|
||||
}
|
||||
|
||||
pub fn is_attack(&self) -> bool {
|
||||
match self {
|
||||
matches!(self,
|
||||
CharacterState::BasicMelee(_)
|
||||
| CharacterState::BasicRanged(_)
|
||||
| CharacterState::DashMelee(_)
|
||||
| CharacterState::TripleStrike(_)
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::SpinMelee(_)
|
||||
| CharacterState::ChargedRanged(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
| CharacterState::ChargedRanged(_))
|
||||
}
|
||||
|
||||
pub fn is_aimed(&self) -> bool {
|
||||
match self {
|
||||
matches!(self,
|
||||
CharacterState::BasicMelee(_)
|
||||
| CharacterState::BasicRanged(_)
|
||||
| CharacterState::DashMelee(_)
|
||||
| CharacterState::TripleStrike(_)
|
||||
| CharacterState::BasicBlock
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::ChargedRanged(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
| CharacterState::ChargedRanged(_))
|
||||
}
|
||||
|
||||
pub fn is_block(&self) -> bool {
|
||||
match self {
|
||||
CharacterState::BasicBlock => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_block(&self) -> bool { matches!(self, CharacterState::BasicBlock) }
|
||||
|
||||
pub fn is_dodge(&self) -> bool {
|
||||
match self {
|
||||
CharacterState::Roll(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_dodge(&self) -> bool { matches!(self, CharacterState::Roll(_)) }
|
||||
|
||||
/// Compares for shallow equality (does not check internal struct equality)
|
||||
pub fn same_variant(&self, other: &Self) -> bool {
|
||||
|
@ -25,10 +25,5 @@ pub enum MatCell {
|
||||
impl Vox for MatCell {
|
||||
fn empty() -> Self { MatCell::None }
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
match self {
|
||||
MatCell::None => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn is_empty(&self) -> bool { matches!(self, MatCell::None) }
|
||||
}
|
||||
|
@ -201,12 +201,7 @@ impl BlockKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_fluid(&self) -> bool {
|
||||
match self {
|
||||
BlockKind::Water => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn is_fluid(&self) -> bool { matches!(self, BlockKind::Water) }
|
||||
|
||||
pub fn get_glow(&self) -> Option<u8> {
|
||||
// TODO: When we have proper volumetric lighting
|
||||
|
@ -32,12 +32,7 @@ pub enum StructureBlock {
|
||||
impl Vox for StructureBlock {
|
||||
fn empty() -> Self { StructureBlock::None }
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
match self {
|
||||
StructureBlock::None => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn is_empty(&self) -> bool { matches!(self, StructureBlock::None) }
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![cfg_attr(test, deny(rust_2018_idioms))]
|
||||
#![cfg_attr(test, deny(warnings))]
|
||||
#![feature(try_trait, const_if_match)]
|
||||
#![feature(try_trait)]
|
||||
|
||||
//! Crate to handle high level networking of messages with different
|
||||
//! requirements and priorities over a number of protocols
|
||||
|
@ -112,25 +112,19 @@ pub(crate) fn partial_eq_bincode(first: &bincode::ErrorKind, second: &bincode::E
|
||||
bincode::ErrorKind::InvalidBoolEncoding(s) => f == s,
|
||||
_ => false,
|
||||
},
|
||||
bincode::ErrorKind::InvalidCharEncoding => match *second {
|
||||
bincode::ErrorKind::InvalidCharEncoding => true,
|
||||
_ => false,
|
||||
bincode::ErrorKind::InvalidCharEncoding => {
|
||||
matches!(*second, bincode::ErrorKind::InvalidCharEncoding)
|
||||
},
|
||||
bincode::ErrorKind::InvalidTagEncoding(f) => match *second {
|
||||
bincode::ErrorKind::InvalidTagEncoding(s) => f == s,
|
||||
_ => false,
|
||||
},
|
||||
bincode::ErrorKind::DeserializeAnyNotSupported => match *second {
|
||||
bincode::ErrorKind::DeserializeAnyNotSupported => true,
|
||||
_ => false,
|
||||
bincode::ErrorKind::DeserializeAnyNotSupported => {
|
||||
matches!(*second, bincode::ErrorKind::DeserializeAnyNotSupported)
|
||||
},
|
||||
bincode::ErrorKind::SizeLimit => match *second {
|
||||
bincode::ErrorKind::SizeLimit => true,
|
||||
_ => false,
|
||||
},
|
||||
bincode::ErrorKind::SequenceMustHaveLength => match *second {
|
||||
bincode::ErrorKind::SequenceMustHaveLength => true,
|
||||
_ => false,
|
||||
bincode::ErrorKind::SizeLimit => matches!(*second, bincode::ErrorKind::SizeLimit),
|
||||
bincode::ErrorKind::SequenceMustHaveLength => {
|
||||
matches!(*second, bincode::ErrorKind::SequenceMustHaveLength)
|
||||
},
|
||||
bincode::ErrorKind::Custom(ref f) => match *second {
|
||||
bincode::ErrorKind::Custom(ref s) => f == s,
|
||||
|
@ -1 +1 @@
|
||||
nightly-2020-06-22
|
||||
nightly-2020-08-15
|
||||
|
@ -50,17 +50,17 @@ impl Client {
|
||||
}
|
||||
|
||||
pub fn is_registered(&self) -> bool {
|
||||
match self.client_state {
|
||||
ClientState::Registered | ClientState::Spectator | ClientState::Character => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
self.client_state,
|
||||
ClientState::Registered | ClientState::Spectator | ClientState::Character
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_ingame(&self) -> bool {
|
||||
match self.client_state {
|
||||
ClientState::Spectator | ClientState::Character => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
self.client_state,
|
||||
ClientState::Spectator | ClientState::Character
|
||||
)
|
||||
}
|
||||
|
||||
pub fn allow_state(&mut self, new_state: ClientState) {
|
||||
|
@ -33,6 +33,7 @@ pub fn handle_damage(server: &Server, uid: Uid, change: HealthChange) {
|
||||
/// other players. If the entity that killed it had stats, then give it exp for
|
||||
/// the kill. Experience given is equal to the level of the entity that was
|
||||
/// killed times 10.
|
||||
#[allow(clippy::needless_collect)]
|
||||
pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSource) {
|
||||
let state = server.state_mut();
|
||||
|
||||
|
@ -33,6 +33,7 @@ pub fn snuff_lantern(storage: &mut WriteStorage<comp::LightEmitter>, entity: Ecs
|
||||
}
|
||||
|
||||
#[allow(clippy::blocks_in_if_conditions)]
|
||||
#[allow(clippy::same_item_push)] // TODO: Pending review in #587
|
||||
pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::InventoryManip) {
|
||||
let state = server.state_mut();
|
||||
let mut dropped_items = Vec::new();
|
||||
|
@ -206,6 +206,7 @@ impl StateExt for State {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::map_identity)] // TODO: Pending review in #587
|
||||
fn update_character_data(&mut self, entity: EcsEntity, components: PersistedComponents) {
|
||||
let (body, stats, inventory, loadout) = components;
|
||||
// Make sure physics are accepted.
|
||||
|
@ -338,7 +338,7 @@ impl<'a> System<'a> for Sys {
|
||||
.filter(|o| o.get_pos().and_then(&is_near).unwrap_or(true))
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
if outcomes.len() > 0 {
|
||||
if !outcomes.is_empty() {
|
||||
client.notify(ServerMsg::Outcomes(outcomes));
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ impl Sys {
|
||||
});
|
||||
|
||||
// Give the player a welcome message
|
||||
if settings.server_description.len() > 0 {
|
||||
if !settings.server_description.is_empty() {
|
||||
client.notify(
|
||||
ChatType::CommandInfo
|
||||
.server_msg(settings.server_description.clone()),
|
||||
|
@ -44,6 +44,7 @@ pub struct AudioFrontend {
|
||||
listener: Listener,
|
||||
}
|
||||
|
||||
#[allow(clippy::same_item_push)] // TODO: Pending review in #587
|
||||
impl AudioFrontend {
|
||||
/// Construct with given device
|
||||
#[allow(clippy::redundant_clone)] // TODO: Pending review in #587
|
||||
|
@ -171,11 +171,7 @@ impl CombatEventMapper {
|
||||
/// ::Equipping to mean the weapon is drawn. This will need updating if the
|
||||
/// animations change to match the wield_duration associated with the weapon
|
||||
fn weapon_drawn(character: &CharacterState) -> bool {
|
||||
character.is_wield()
|
||||
|| match character {
|
||||
CharacterState::Equipping { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
character.is_wield() || matches!(character, CharacterState::Equipping { .. })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,10 +395,7 @@ impl<'a> Widget for Chat<'a> {
|
||||
.widget_input(state.ids.chat_input)
|
||||
.presses()
|
||||
.key()
|
||||
.any(|key_press| match key_press.key {
|
||||
Key::Return if !state.input.is_empty() => true,
|
||||
_ => false,
|
||||
})
|
||||
.any(|key_press| matches!(key_press.key, Key::Return if !state.input.is_empty()))
|
||||
{
|
||||
let msg = state.input.clone();
|
||||
state.update(|s| {
|
||||
|
@ -477,10 +477,7 @@ impl Show {
|
||||
|| self.spell
|
||||
|| self.help
|
||||
|| self.intro
|
||||
|| match self.open_windows {
|
||||
Windows::None => false,
|
||||
_ => true,
|
||||
}
|
||||
|| !matches!(self.open_windows, Windows::None)
|
||||
{
|
||||
self.bag = false;
|
||||
self.esc_menu = false;
|
||||
@ -2453,7 +2450,7 @@ impl Hud {
|
||||
// conrod eats tabs. Un-eat a tabstop so tab completion can work
|
||||
if self.ui.ui.global_input().events().any(|event| {
|
||||
use conrod_core::{event, input};
|
||||
match event {
|
||||
matches!(event,
|
||||
//event::Event::Raw(event::Input::Press(input::Button::Keyboard(input::Key::Tab)))
|
||||
// => true,
|
||||
event::Event::Ui(event::Ui::Press(
|
||||
@ -2462,9 +2459,7 @@ impl Hud {
|
||||
button: event::Button::Keyboard(input::Key::Tab),
|
||||
..
|
||||
},
|
||||
)) => true,
|
||||
_ => false,
|
||||
}
|
||||
)))
|
||||
}) {
|
||||
self.ui
|
||||
.ui
|
||||
|
@ -43,6 +43,7 @@ impl ParticleMgr {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::same_item_push)] // TODO: Pending review in #587
|
||||
pub fn handle_outcome(&mut self, outcome: &Outcome, scene_data: &SceneData) {
|
||||
let time = scene_data.state.get_time();
|
||||
let mut rng = rand::thread_rng();
|
||||
@ -177,6 +178,7 @@ impl ParticleMgr {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::same_item_push)] // TODO: Pending review in #587
|
||||
fn maintain_boltfirebig_particles(&mut self, scene_data: &SceneData, pos: &Pos) {
|
||||
let time = scene_data.state.get_time();
|
||||
|
||||
@ -223,6 +225,7 @@ impl ParticleMgr {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::same_item_push)] // TODO: Pending review in #587
|
||||
fn maintain_boost_particles(&mut self, scene_data: &SceneData) {
|
||||
let state = scene_data.state;
|
||||
let ecs = state.ecs();
|
||||
|
@ -660,12 +660,7 @@ pub enum AudioOutput {
|
||||
}
|
||||
|
||||
impl AudioOutput {
|
||||
pub fn is_enabled(&self) -> bool {
|
||||
match self {
|
||||
Self::Off => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
pub fn is_enabled(&self) -> bool { !matches!(self, Self::Off) }
|
||||
}
|
||||
/// `AudioSettings` controls the volume of different audio subsystems and which
|
||||
/// device is used.
|
||||
|
@ -30,23 +30,19 @@ impl Event {
|
||||
}
|
||||
|
||||
pub fn is_keyboard_or_mouse(&self) -> bool {
|
||||
match self.0 {
|
||||
matches!(self.0,
|
||||
Input::Press(_)
|
||||
| Input::Release(_)
|
||||
| Input::Motion(_)
|
||||
| Input::Touch(_)
|
||||
| Input::Text(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
| Input::Text(_))
|
||||
}
|
||||
|
||||
pub fn is_keyboard(&self) -> bool {
|
||||
match self.0 {
|
||||
matches!(self.0,
|
||||
Input::Press(Button::Keyboard(_))
|
||||
| Input::Release(Button::Keyboard(_))
|
||||
| Input::Text(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
| Input::Text(_))
|
||||
}
|
||||
|
||||
pub fn new_resize(dims: Vec2<f64>) -> Self { Self(Input::Resize(dims.x, dims.y)) }
|
||||
|
@ -111,29 +111,11 @@ pub enum RiverKind {
|
||||
}
|
||||
|
||||
impl RiverKind {
|
||||
pub fn is_ocean(&self) -> bool {
|
||||
if let RiverKind::Ocean = *self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
pub fn is_ocean(&self) -> bool { matches!(self, RiverKind::Ocean) }
|
||||
|
||||
pub fn is_river(&self) -> bool {
|
||||
if let RiverKind::River { .. } = *self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
pub fn is_river(&self) -> bool { matches!(self, RiverKind::River { .. }) }
|
||||
|
||||
pub fn is_lake(&self) -> bool {
|
||||
if let RiverKind::Lake { .. } = *self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
pub fn is_lake(&self) -> bool { matches!(self, RiverKind::Lake { .. }) }
|
||||
}
|
||||
|
||||
impl PartialOrd for RiverKind {
|
||||
|
@ -110,6 +110,7 @@ impl MapConfig {
|
||||
/// into the correct format for a buffer and writes to it.
|
||||
#[allow(clippy::if_same_then_else)] // TODO: Pending review in #587
|
||||
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
|
||||
#[allow(clippy::map_identity)] // TODO: Pending review in #587
|
||||
#[allow(clippy::many_single_char_names)]
|
||||
pub fn generate(
|
||||
&self,
|
||||
|
@ -93,21 +93,9 @@ pub enum StoreyFill {
|
||||
}
|
||||
|
||||
impl StoreyFill {
|
||||
fn has_lower(&self) -> bool {
|
||||
if let StoreyFill::All = self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
fn has_lower(&self) -> bool { matches!(self, StoreyFill::All) }
|
||||
|
||||
fn has_upper(&self) -> bool {
|
||||
if let StoreyFill::None = self {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
fn has_upper(&self) -> bool { !matches!(self, StoreyFill::None) }
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -236,10 +236,7 @@ impl Settlement {
|
||||
let origin = dir.map(|e| (e * 100.0) as i32);
|
||||
let origin = self
|
||||
.land
|
||||
.find_tile_near(origin, |plot| match plot {
|
||||
Some(&Plot::Field { .. }) => true,
|
||||
_ => false,
|
||||
})
|
||||
.find_tile_near(origin, |plot| matches!(plot, Some(&Plot::Field { .. })))
|
||||
.unwrap();
|
||||
|
||||
if let Some(path) = self.town.as_ref().and_then(|town| {
|
||||
@ -520,7 +517,7 @@ impl Settlement {
|
||||
.land
|
||||
.get_at_block(wpos - self.origin)
|
||||
.plot
|
||||
.map(|p| if let Plot::Hazard = p { true } else { false })
|
||||
.map(|p| matches!(p, Plot::Hazard))
|
||||
.unwrap_or(true),
|
||||
..SpawnRules::default()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user