1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

games/veloren-weekly: drop rust < 1.70 workaround after 6b9789547d

This commit is contained in:
Jan Beich 2023-06-10 23:02:59 +00:00
parent f435d20aec
commit 2ee0d78bf4
2 changed files with 1 additions and 476 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= veloren
PORTVERSION= s20230607
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= games wayland
PKGNAMESUFFIX= -weekly

View File

@ -1,475 +0,0 @@
Revert https://gitlab.com/veloren/veloren/-/commit/95bca5418af7
until lang/rust >= 1.70 update e.g.,
https://github.com/rust-lang/rust/commit/8a7ca936e61d
error[E0658]: use of unstable library feature 'once_cell'
--> voxygen/src/scene/terrain.rs:620:20
|
620 | let init = core::cell::OnceCell::new();
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information
= help: add `#![feature(once_cell)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'once_cell'
--> voxygen/src/scene/terrain.rs:620:20
|
620 | let init = core::cell::OnceCell::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information
= help: add `#![feature(once_cell)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'once_cell'
--> voxygen/src/scene/terrain.rs:656:39
|
656 | Box::new(move |renderer| init.get_or_init(|| closure(renderer)).clone())
| ^^^^^^^^^^^
|
= note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information
= help: add `#![feature(once_cell)]` to the crate attributes to enable
diff --git client/src/bin/bot/main.rs client/src/bin/bot/main.rs
index ca7298d81b7e..f1c31e449b71 100644
--- client/src/bin/bot/main.rs
+++ client/src/bin/bot/main.rs
@@ -117,6 +117,7 @@ impl BotClient {
pub fn handle_register(&mut self, prefix: &str, password: &str, count: Option<usize>) {
let usernames = match count {
Some(n) => (0..n)
+ .into_iter()
.map(|i| format!("{}{:03}", prefix, i))
.collect::<Vec<String>>(),
None => vec![prefix.to_string()],
diff --git common/src/comp/agent.rs common/src/comp/agent.rs
index 6fd73d380dae..39f9d232052e 100644
--- common/src/comp/agent.rs
+++ common/src/comp/agent.rs
@@ -503,7 +503,7 @@ impl Timer {
/// Reset the timer for the given action, returning true if the timer was
/// not already reset.
pub fn reset(&mut self, action: TimerAction) -> bool {
- self.action_starts[Self::idx_for(action)].take().is_some()
+ std::mem::replace(&mut self.action_starts[Self::idx_for(action)], None).is_some()
}
/// Start the timer for the given action, even if it was already started.
diff --git common/src/comp/inventory/item/mod.rs common/src/comp/inventory/item/mod.rs
index 2716aac923e3..06c9a49a21bf 100644
--- common/src/comp/inventory/item/mod.rs
+++ common/src/comp/inventory/item/mod.rs
@@ -330,7 +330,7 @@ impl ItemKind {
// Used for inventory sorting, what comes before the first colon (:) is used as
// a broader category
pub fn get_itemkind_string(&self) -> String {
- match self {
+ let result = match self {
// Using tool and toolkind to sort tools by kind
ItemKind::Tool(tool) => format!("Tool: {:?}", tool.kind),
ItemKind::ModularComponent(modular_component) => {
@@ -346,7 +346,8 @@ impl ItemKind {
ItemKind::Utility { kind } => format!("Utility: {:?}", kind),
ItemKind::Ingredient { descriptor } => format!("Ingredient: {}", descriptor),
ItemKind::TagExamples { item_ids } => format!("TagExamples: {:?}", item_ids),
- }
+ };
+ result
}
pub fn has_durability(&self) -> bool {
diff --git common/src/comp/skillset/mod.rs common/src/comp/skillset/mod.rs
index 6b14321b5e65..21bb5ebda3fd 100644
--- common/src/comp/skillset/mod.rs
+++ common/src/comp/skillset/mod.rs
@@ -81,6 +81,7 @@ lazy_static! {
.map(|skill| {
let max_level = skill.max_level();
(1..=max_level)
+ .into_iter()
.map(|level| skill.skill_cost(level))
.sum::<u16>()
})
diff --git common/src/skillset_builder.rs common/src/skillset_builder.rs
index d330f2c834b7..f3df4511f1aa 100644
--- common/src/skillset_builder.rs
+++ common/src/skillset_builder.rs
@@ -112,7 +112,8 @@ impl SkillSetBuilder {
pub fn with_skill(mut self, skill: Skill, level: u16) -> Self {
let Some(group) = skill.skill_group_kind() else {
let err = format!(
- "Tried to add skill: {skill:?} which does not have an associated skill group."
+ "Tried to add skill: {:?} which does not have an associated skill group.",
+ skill
);
common_base::dev_panic!(err, or return self);
};
@@ -120,7 +121,8 @@ impl SkillSetBuilder {
let SkillSetBuilder(ref mut skill_set) = self;
if skill_is_applied(skill_set, skill, level) {
let err = format!(
- "Tried to add skill: {skill:?} with level {level:?} which is already applied"
+ "Tried to add skill: {:?} with level {:?} which is already applied",
+ skill, level,
);
common_base::dev_panic!(err, or return self);
}
@@ -133,8 +135,9 @@ impl SkillSetBuilder {
}
if !skill_is_applied(skill_set, skill, level) {
let err = format!(
- "Failed to add skill: {skill:?}. Verify that it has the appropriate skill group \
- available and meets all prerequisite skills."
+ "Failed to add skill: {:?}. Verify that it has the appropriate skill group \
+ available and meets all prerequisite skills.",
+ skill
);
common_base::dev_panic!(err);
}
diff --git common/src/terrain/biome.rs common/src/terrain/biome.rs
index c40956863fb0..8b6c83c8b4b3 100644
--- common/src/terrain/biome.rs
+++ common/src/terrain/biome.rs
@@ -1,9 +1,8 @@
use serde::{Deserialize, Serialize};
use strum::EnumIter;
-#[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, EnumIter)]
+#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, EnumIter)]
pub enum BiomeKind {
- #[default]
Void,
Lake,
Grassland,
@@ -17,3 +16,7 @@ pub enum BiomeKind {
Savannah,
Taiga,
}
+
+impl Default for BiomeKind {
+ fn default() -> BiomeKind { BiomeKind::Void }
+}
diff --git common/src/terrain/site.rs common/src/terrain/site.rs
index 8358daaf2d24..fdcee627fd8c 100644
--- common/src/terrain/site.rs
+++ common/src/terrain/site.rs
@@ -1,12 +1,11 @@
use serde::{Deserialize, Serialize};
-#[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum SiteKindMeta {
Dungeon(DungeonKindMeta),
Cave,
Settlement(SettlementKindMeta),
Castle,
- #[default]
Void,
}
@@ -23,3 +22,7 @@ pub enum SettlementKindMeta {
DesertCity,
SavannahPit,
}
+
+impl Default for SiteKindMeta {
+ fn default() -> SiteKindMeta { SiteKindMeta::Void }
+}
diff --git common/src/typed.rs common/src/typed.rs
index 752c8d908dcf..ea7d97f66a19 100644
--- common/src/typed.rs
+++ common/src/typed.rs
@@ -321,7 +321,7 @@ macro_rules! make_case_elim {
elim.reduce(((self,), context))
}
- pub fn elim_case_pure<'a, Type>(&self, cases: &'a $mod::PureCases<Type>) -> &'a Type
+ pub fn elim_case_pure<'a, 'b, Type>(&'a self, cases: &'b $mod::PureCases<Type>) -> &'b Type
{
let (expr, ()) = self.elim(cases, ());
expr
@@ -425,7 +425,7 @@ macro_rules! make_proj_elim {
elim.reduce(((self,), context))
}
- pub fn elim_proj_pure<'a, Type>(&self, cases: &'a $mod::PureProj<Type>) -> &'a Type
+ pub fn elim_proj_pure<'a, 'b, Type>(&'a self, cases: &'b $mod::PureProj<Type>) -> &'b Type
{
let (expr, ()) = self.elim(cases, ());
expr
diff --git rust-toolchain rust-toolchain
index b27a258d1a80..c7c621708744 100644
--- rust-toolchain
+++ rust-toolchain
@@ -1 +1 @@
-nightly-2023-04-20
+nightly-2022-11-28
diff --git server/src/events/inventory_manip.rs server/src/events/inventory_manip.rs
index f86f23d31fba..bb62a7ba0305 100644
--- server/src/events/inventory_manip.rs
+++ server/src/events/inventory_manip.rs
@@ -786,6 +786,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
})
.and_then(|r| {
let items = (0..amount)
+ .into_iter()
.filter_map(|_| {
r.craft_simple(
&mut inventory,
diff --git server/src/sys/chunk_serialize.rs server/src/sys/chunk_serialize.rs
index 4226ea0429f3..0810aa9951a9 100644
--- server/src/sys/chunk_serialize.rs
+++ server/src/sys/chunk_serialize.rs
@@ -110,6 +110,7 @@ impl<'a> System<'a> for Sys {
.get_key_arc_real(chunk_key)
.map(|chunk| (Arc::clone(chunk), chunk_key, meta))
})
+ .into_iter()
.peekable();
while chunks_iter.peek().is_some() {
diff --git voxygen/src/lib.rs voxygen/src/lib.rs
index bee0a875709e..ccb5eb34d3e5 100644
--- voxygen/src/lib.rs
+++ voxygen/src/lib.rs
@@ -6,6 +6,7 @@
array_methods,
array_zip,
drain_filter,
+ once_cell,
trait_alias,
option_get_or_insert_default,
map_try_insert,
diff --git voxygen/src/render/mod.rs voxygen/src/render/mod.rs
index 9764930c0cc2..d77cf8806a5b 100644
--- voxygen/src/render/mod.rs
+++ voxygen/src/render/mod.rs
@@ -70,13 +70,12 @@ pub trait Vertex: Clone + bytemuck::Pod {
use serde::{Deserialize, Serialize};
/// Anti-aliasing modes
-#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum AaMode {
/// Fast approximate antialiasing.
///
/// This is a screen-space technique, and therefore works fine with greedy
/// meshing.
- #[default]
Fxaa,
/// Multisampling AA, up to 4 samples per pixel.
///
@@ -122,8 +121,12 @@ impl AaMode {
}
}
+impl Default for AaMode {
+ fn default() -> Self { AaMode::Fxaa }
+}
+
/// Cloud modes
-#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum CloudMode {
/// No clouds. As cheap as it gets.
None,
@@ -141,7 +144,6 @@ pub enum CloudMode {
Ultra,
/// Lots of detail with good-but-costly derivation of parameters.
#[serde(other)]
- #[default]
High,
}
@@ -149,8 +151,12 @@ impl CloudMode {
pub fn is_enabled(&self) -> bool { *self != CloudMode::None }
}
+impl Default for CloudMode {
+ fn default() -> Self { CloudMode::High }
+}
+
/// Fluid modes
-#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum FluidMode {
/// "Low" water. This water implements no waves, no reflections, no
/// diffraction, and no light attenuation through water. As a result,
@@ -174,26 +180,32 @@ pub enum FluidMode {
/// which causes attenuation to be computed incorrectly; this can be
/// addressed by using shadow maps (at least for terrain).
#[serde(other)]
- #[default]
Medium,
}
+impl Default for FluidMode {
+ fn default() -> Self { FluidMode::Medium }
+}
+
/// Reflection modes
-#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum ReflectionMode {
/// No or minimal reflections.
Low,
/// High quality reflections with screen-space raycasting and
/// all the bells & whistles.
- #[default]
High,
// Medium quality screen-space reflections.
#[serde(other)]
Medium,
}
+impl Default for ReflectionMode {
+ fn default() -> Self { ReflectionMode::High }
+}
+
/// Lighting modes
-#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum LightingMode {
/// Ashikhmin-Shirley BRDF lighting model. Attempts to generate a
/// physically plausible (to some extent) lighting distribution.
@@ -210,10 +222,13 @@ pub enum LightingMode {
/// Standard Blinn-Phong shading, combing Lambertian diffuse reflections and
/// specular highlights.
#[serde(other)]
- #[default]
BlinnPhong,
}
+impl Default for LightingMode {
+ fn default() -> Self { LightingMode::BlinnPhong }
+}
+
/// Shadow map settings.
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
pub struct ShadowMapMode {
@@ -299,7 +314,7 @@ impl From<PresentMode> for wgpu::PresentMode {
/// Bloom factor
/// Controls fraction of output image luminosity that is blurred bloom
-#[derive(Default, PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum BloomFactor {
Low,
High,
@@ -307,10 +322,13 @@ pub enum BloomFactor {
Custom(f32),
// other variant has to be placed last
#[serde(other)]
- #[default]
Medium,
}
+impl Default for BloomFactor {
+ fn default() -> Self { Self::Medium }
+}
+
impl BloomFactor {
/// Fraction of output image luminosity that is blurred bloom
pub fn fraction(self) -> f32 {
diff --git voxygen/src/window.rs voxygen/src/window.rs
index 0713ad4a0eaf..fd1e62ae04fe 100644
--- voxygen/src/window.rs
+++ voxygen/src/window.rs
@@ -1359,14 +1359,16 @@ impl Window {
pub fn scale_factor(&self) -> f64 { self.scale_factor }
}
-#[derive(Default, Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)]
pub enum FullscreenMode {
Exclusive,
#[serde(other)]
- #[default]
Borderless,
}
+impl Default for FullscreenMode {
+ fn default() -> Self { FullscreenMode::Borderless }
+}
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[serde(default)]
pub struct FullScreenSettings {
diff --git world/examples/chunk_compression_benchmarks.rs world/examples/chunk_compression_benchmarks.rs
index 46727195b953..5cf915701c89 100644
--- world/examples/chunk_compression_benchmarks.rs
+++ world/examples/chunk_compression_benchmarks.rs
@@ -1190,7 +1190,10 @@ fn main() {
if !SKIP_VOLGRID {
let _ = volgrid.insert(spiralpos, Arc::new(chunk));
- if (1usize..20).any(|i| (2 * i + 1) * (2 * i + 1) == count) {
+ if (1usize..20)
+ .into_iter()
+ .any(|i| (2 * i + 1) * (2 * i + 1) == count)
+ {
use std::fs::File;
let mut f = File::create(&format!("chonkjpegs/{}_{}.jpg", sitename, count))
.unwrap();
diff --git world/examples/world_block_statistics.rs world/examples/world_block_statistics.rs
index a0bf81309fbe..bd478b75dd82 100644
--- world/examples/world_block_statistics.rs
+++ world/examples/world_block_statistics.rs
@@ -85,9 +85,12 @@ fn generate(db_path: &str, ymin: Option<i32>, ymax: Option<i32>) -> Result<(), B
let (tx, rx) = mpsc::channel();
rayon::spawn(move || {
let coords: Vec<_> = (ymin.unwrap_or(1)..ymax.unwrap_or(sz.y as i32))
+ .into_iter()
.flat_map(move |y| {
let tx = tx.clone();
- (1..sz.x as i32).map(move |x| (tx.clone(), x, y))
+ (1..sz.x as i32)
+ .into_iter()
+ .map(move |x| (tx.clone(), x, y))
})
.collect();
coords.into_par_iter().for_each(|(tx, x, y)| {
diff --git world/src/sim/util.rs world/src/sim/util.rs
index f94d584b2f0c..bc7d49a4a684 100644
--- world/src/sim/util.rs
+++ world/src/sim/util.rs
@@ -218,6 +218,7 @@ pub fn local_cells(map_size_lg: MapSizeLg, posi: usize) -> impl Clone + Iterator
let grid_size = 3i32;
let grid_bounds = 2 * grid_size + 1;
(0..grid_bounds * grid_bounds)
+ .into_iter()
.map(move |index| {
Vec2::new(
pos.x + (index % grid_bounds) - grid_size,
diff --git world/src/site2/plot/dungeon.rs world/src/site2/plot/dungeon.rs
index 1b092edcc926..b44b9df3f89f 100644
--- world/src/site2/plot/dungeon.rs
+++ world/src/site2/plot/dungeon.rs
@@ -948,7 +948,7 @@ pub fn inscribed_polystar(
use std::f32::consts::TAU;
let rpos: Vec2<f32> = pos.xy().as_() - origin.as_();
let is_border = rpos.magnitude_squared() > (radius - 2.0).powi(2);
- let is_line = (0..sides).any(|i| {
+ let is_line = (0..sides).into_iter().any(|i| {
let f = |j: f32| {
let t = j * TAU / sides as f32;
radius * Vec2::new(t.cos(), t.sin())
diff --git world/src/site2/plot/gnarling.rs world/src/site2/plot/gnarling.rs
index 837390d8c6d5..9606622410ab 100644
--- world/src/site2/plot/gnarling.rs
+++ world/src/site2/plot/gnarling.rs
@@ -112,6 +112,7 @@ impl GnarlingFortification {
let num_points = (wall_radius / 15).max(5);
let outer_wall_corners = (0..num_points)
+ .into_iter()
.map(|a| {
let angle = a as f32 / num_points as f32 * core::f32::consts::TAU;
Vec2::new(angle.cos(), angle.sin()).map(|a| (a * wall_radius as f32) as i32)
@@ -447,6 +448,7 @@ impl Structure for GnarlingFortification {
const SECTIONS_PER_WALL_SEGMENT: usize = 8;
(0..(SECTIONS_PER_WALL_SEGMENT as i32))
+ .into_iter()
.map(move |a| {
let get_point =
|a| point + (next_point - point) * a / (SECTIONS_PER_WALL_SEGMENT as i32);