Merge branch 'xMAC94x/update-toolchain' into 'master'

update toolchain to `nightly-2022-04-25`

See merge request veloren/veloren!3343
This commit is contained in:
Marcel 2022-05-03 14:07:49 +00:00
commit 84ab219cf3
20 changed files with 49 additions and 43 deletions

View File

@ -13,7 +13,7 @@ variables:
# https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f
CACHE_IMAGE_TAG: d7756444
CACHE_IMAGE_TAG: 59fdc4df
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
default:

View File

@ -2,6 +2,5 @@
echo "modifying files in 5s, ctrl+c to abort" && sleep 5
find ./* -name "Cargo.toml" -exec sed -i 's/, "simd"]/]/g' {} \;
find ./* -name "Cargo.toml" -exec sed -i 's/"simd"]/]/g' {} \;
sed -i 's/vek /#vek /g' ./Cargo.toml;
export VELOREN_ASSETS="$(pwd)/assets";
time cargo tarpaulin --skip-clean -v -- --test-threads=2;

View File

@ -1634,7 +1634,7 @@ impl Client {
// 1 as a buffer so that if the player moves back in that direction the chunks
// don't need to be reloaded
if (chunk_pos - key)
.map(|e: i32| (e.abs() as u32).saturating_sub(2))
.map(|e: i32| (e.unsigned_abs()).saturating_sub(2))
.magnitude_squared()
> view_distance.pow(2)
{

View File

@ -161,6 +161,12 @@ impl Drop for GuardlessSpan {
}
}
/// Just implemented so that we dont need to have
/// #[allow(clippy::drop_non_drop)] everywhere
impl Drop for ProfSpan {
fn drop(&mut self) {}
}
#[macro_export]
macro_rules! no_guard_span {
($level:ident, $name:expr, $($fields:tt)*) => {

View File

@ -30,7 +30,7 @@ impl Combo {
self.counter = if amount > 0 {
self.counter.saturating_add(amount as u32)
} else {
self.counter.saturating_sub(amount.abs() as u32)
self.counter.saturating_sub(amount.unsigned_abs())
};
self.last_increase = time;
}

View File

@ -259,7 +259,7 @@ fn make_tagexample_def(
toolkind.identifier_name()
);
let kind = ItemKind::TagExamples {
item_ids: exemplars.get(&tag).cloned().unwrap_or_else(Vec::new),
item_ids: exemplars.get(&tag).cloned().unwrap_or_default(),
};
let quality = Quality::Common;

View File

@ -75,7 +75,7 @@ pub struct MaterialFrequency(Vec<(f32, Good)>);
// price[i] = 1/frequency[i] * 1/sum(frequency) * 1/sum(1/frequency)
// scaling individual components so that ratio is inverted and the sum of all
// inverted elements is equivalent to inverse of the original sum
fn vector_invert(result: &mut Vec<(f32, Good)>) {
fn vector_invert(result: &mut [(f32, Good)]) {
let mut oldsum: f32 = 0.0;
let mut newsum: f32 = 0.0;
for (value, _good) in result.iter_mut() {
@ -421,7 +421,7 @@ impl TradePricing {
// re-look up prices and sort the vector by ascending material cost, return
// whether first cost is finite
fn sort_by_price(&self, recipes: &mut Vec<RememberedRecipe>) -> bool {
fn sort_by_price(&self, recipes: &mut [RememberedRecipe]) -> bool {
for recipe in recipes.iter_mut() {
recipe.material_cost = self.calculate_material_cost_sum(recipe);
}

View File

@ -135,7 +135,7 @@ impl RegionMap {
// Calculate distance outside border
if key != current_region
&& (Vec2::<i32>::from(pos) - Self::key_pos(current_region))
.map(|e| e.abs() as u32)
.map(|e| e.unsigned_abs())
.reduce_max()
> TETHER_LENGTH
{

View File

@ -1 +1 @@
nightly-2021-12-19
nightly-2022-04-25

View File

@ -318,7 +318,7 @@ impl<'a> System<'a> for Sys {
// 1 since chunks need neighbors to be meshed
// 1 to act as a buffer if the player moves in that direction
let adjusted_dist_sqr = (chunk_pos - key)
.map(|e: i32| (e.abs() as u32).saturating_sub(2))
.map(|e: i32| (e.unsigned_abs()).saturating_sub(2))
.magnitude_squared();
if adjusted_dist_sqr <= presence.view_distance.pow(2) {
@ -341,7 +341,7 @@ impl<'a> System<'a> for Sys {
.iter()
.map(|(k, _)| k)
// Don't check every chunk every tick (spread over 16 ticks)
.filter(|k| k.x.abs() as u64 % 4 + (k.y.abs() as u64 % 4) * 4 == tick.0 % 16)
.filter(|k| k.x.unsigned_abs() % 4 + (k.y.unsigned_abs() % 4) * 4 == (tick.0 % 16) as u32)
// There shouldn't be to many pending chunks so we will just check them all
.chain(chunk_generator.pending_chunks())
.for_each(|chunk_key| {
@ -536,7 +536,7 @@ pub fn chunk_in_vd(
let player_chunk_pos = terrain.pos_key(player_pos.map(|e| e as i32));
let adjusted_dist_sqr = (player_chunk_pos - chunk_pos)
.map(|e: i32| e.abs() as u32)
.map(|e: i32| e.unsigned_abs())
.magnitude_squared();
adjusted_dist_sqr <= (vd.max(crate::MIN_VD) + UNLOAD_THRESHOLD).pow(2)

View File

@ -1,5 +1,6 @@
#![feature(generic_associated_types, bool_to_option)]
#![allow(incomplete_features)]
#![allow(clippy::single_match)]
#[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");

View File

@ -1260,7 +1260,7 @@ impl<'a> Widget for Diary<'a> {
(None, None) => String::new(),
}
},
unknown => unreachable!(unknown),
unknown => unreachable!("{}", unknown),
};
let mut number = Text::new(&value)

View File

@ -52,6 +52,7 @@ impl State {
pub fn clear_slot(&mut self, slot: Slot) { self.slots[slot as usize] = None; }
#[allow(clippy::only_used_in_recursion)] // false positive
pub fn add_inventory_link(&mut self, slot: Slot, item: &Item) {
self.slots[slot as usize] = Some(SlotContents::Inventory(
item.item_hash(),

View File

@ -1062,8 +1062,9 @@ impl Hud {
let slot_manager = slots::SlotManager::new(
ui.id_generator(),
Vec2::broadcast(40.0)
// TODO(heyzoos) Will be useful for whoever works on rendering the number of items "in hand".
Vec2::broadcast(40.0),
// TODO(heyzoos) Will be useful for whoever works on rendering the number of items
// "in hand".
// fonts.cyri.conrod_id,
// Vec2::new(1.0, 1.0),
// fonts.cyri.scale(12),

View File

@ -129,6 +129,7 @@ impl ShadowMap {
};
clear(&cube_tex);
clear(&tex);
#[allow(clippy::drop_non_drop)]
drop(clear);
queue.submit(std::iter::once(encoder.finish()));

View File

@ -5261,11 +5261,9 @@ impl FigureMgr {
&CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
&Last {
0: CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
},
&Last(CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
})),
),
};
@ -5394,11 +5392,9 @@ impl FigureMgr {
&CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
&Last {
0: CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
},
&Last(CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
})),
),
};
@ -5494,11 +5490,9 @@ impl FigureMgr {
&CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
&Last {
0: CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
}),
},
&Last(CharacterState::Idle(common::states::idle::Data {
is_sneaking: false,
})),
),
};

View File

@ -154,8 +154,8 @@ macro_rules! image_ids {
}
impl $Ids {
pub fn load(ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
use crate::ui::img_ids::GraphicCreator;
pub fn load(ui: &mut $crate::ui::Ui) -> Result<Self, common::assets::Error> {
use $crate::ui::img_ids::GraphicCreator;
Ok(Self {
$($( $name: ui.add_graphic(<$T as GraphicCreator>::new_graphic($specifier)?), )*)*
})
@ -169,12 +169,12 @@ macro_rules! image_ids_ice {
($($v:vis struct $Ids:ident { $( <$T:ty> $( $name:ident: $specifier:expr ),* $(,)? )* })*) => {
$(
$v struct $Ids {
$($( $v $name: crate::ui::GraphicId, )*)*
$($( $v $name: $crate::ui::GraphicId, )*)*
}
impl $Ids {
pub fn load(ui: &mut crate::ui::ice::IcedUi) -> Result<Self, common::assets::Error> {
use crate::ui::img_ids::GraphicCreator;
pub fn load(ui: &mut $crate::ui::ice::IcedUi) -> Result<Self, common::assets::Error> {
use $crate::ui::img_ids::GraphicCreator;
Ok(Self {
$($( $name: ui.add_graphic(<$T as GraphicCreator>::new_graphic($specifier)?), )*)*
})
@ -191,12 +191,12 @@ macro_rules! rotation_image_ids {
($($v:vis struct $Ids:ident { $( <$T:ty> $( $name:ident: $specifier:expr ),* $(,)? )* })*) => {
$(
$v struct $Ids {
$($( $v $name: crate::ui::img_ids::Rotations, )*)*
$($( $v $name: $crate::ui::img_ids::Rotations, )*)*
}
impl $Ids {
pub fn load(ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
use crate::ui::img_ids::GraphicCreator;
pub fn load(ui: &mut $crate::ui::Ui) -> Result<Self, common::assets::Error> {
use $crate::ui::img_ids::GraphicCreator;
Ok(Self {
$($( $name: ui.add_graphic_with_rotations(<$T as GraphicCreator>::new_graphic($specifier)?), )*)*
})

View File

@ -462,7 +462,10 @@ impl<'a> Widget for ItemTooltip<'a> {
let quality = get_quality_col(item);
let equip_slot = inventory.equipped_items_of_kind(item.kind().clone());
let first_equipped = inventory
.equipped_items_of_kind(item.kind().clone())
.next()
.cloned();
let (title, desc) = (item.name().to_string(), item.description().to_string());
@ -661,7 +664,7 @@ impl<'a> Widget for ItemTooltip<'a> {
.down_from(state.ids.stats[2], V_PAD_STATS)
.set(state.ids.stats[3], ui);
if let Some(equipped_item) = equip_slot.cloned().next() {
if let Some(equipped_item) = first_equipped {
if let ItemKind::Tool(equipped_tool) = equipped_item.kind() {
let tool_stats = tool
.stats
@ -965,7 +968,7 @@ impl<'a> Widget for ItemTooltip<'a> {
},
}
if let Some(equipped_item) = equip_slot.cloned().next() {
if let Some(equipped_item) = first_equipped {
if let ItemKind::Armor(equipped_armor) = equipped_item.kind() {
let diff = armor.stats - equipped_armor.stats;
let protection_diff = util::option_comparison(

View File

@ -1077,7 +1077,7 @@ pub fn merchant_loadout(
.bag(ArmorSlot::Bag4, Some(bag4))
}
fn sort_wares(bag: &mut Vec<Item>) {
fn sort_wares(bag: &mut [Item]) {
use common::comp::item::TagExampleInfo;
bag.sort_by(|a, b| {

View File

@ -68,7 +68,7 @@ impl TileGrid {
Spiral2d::new()
.take(MAX_SEARCH_CELLS as usize)
.map(|r| tpos + r)
.find_map(|tpos| (&mut f)(tpos, self.get(tpos)).zip(Some(tpos)))
.find_map(|tpos| f(tpos, self.get(tpos)).zip(Some(tpos)))
}
pub fn grow_aabr(