update toolchain to nightly-2023-04-20

This commit is contained in:
Marcel Märtens 2023-05-03 17:28:55 +02:00
parent 07bb4f72aa
commit 95bca5418a
19 changed files with 31 additions and 75 deletions

View File

@ -117,7 +117,6 @@ impl BotClient {
pub fn handle_register(&mut self, prefix: &str, password: &str, count: Option<usize>) { pub fn handle_register(&mut self, prefix: &str, password: &str, count: Option<usize>) {
let usernames = match count { let usernames = match count {
Some(n) => (0..n) Some(n) => (0..n)
.into_iter()
.map(|i| format!("{}{:03}", prefix, i)) .map(|i| format!("{}{:03}", prefix, i))
.collect::<Vec<String>>(), .collect::<Vec<String>>(),
None => vec![prefix.to_string()], None => vec![prefix.to_string()],

View File

@ -503,7 +503,7 @@ impl Timer {
/// Reset the timer for the given action, returning true if the timer was /// Reset the timer for the given action, returning true if the timer was
/// not already reset. /// not already reset.
pub fn reset(&mut self, action: TimerAction) -> bool { pub fn reset(&mut self, action: TimerAction) -> bool {
std::mem::replace(&mut self.action_starts[Self::idx_for(action)], None).is_some() self.action_starts[Self::idx_for(action)].take().is_some()
} }
/// Start the timer for the given action, even if it was already started. /// Start the timer for the given action, even if it was already started.

View File

@ -330,7 +330,7 @@ impl ItemKind {
// Used for inventory sorting, what comes before the first colon (:) is used as // Used for inventory sorting, what comes before the first colon (:) is used as
// a broader category // a broader category
pub fn get_itemkind_string(&self) -> String { pub fn get_itemkind_string(&self) -> String {
let result = match self { match self {
// Using tool and toolkind to sort tools by kind // Using tool and toolkind to sort tools by kind
ItemKind::Tool(tool) => format!("Tool: {:?}", tool.kind), ItemKind::Tool(tool) => format!("Tool: {:?}", tool.kind),
ItemKind::ModularComponent(modular_component) => { ItemKind::ModularComponent(modular_component) => {
@ -346,8 +346,7 @@ impl ItemKind {
ItemKind::Utility { kind } => format!("Utility: {:?}", kind), ItemKind::Utility { kind } => format!("Utility: {:?}", kind),
ItemKind::Ingredient { descriptor } => format!("Ingredient: {}", descriptor), ItemKind::Ingredient { descriptor } => format!("Ingredient: {}", descriptor),
ItemKind::TagExamples { item_ids } => format!("TagExamples: {:?}", item_ids), ItemKind::TagExamples { item_ids } => format!("TagExamples: {:?}", item_ids),
}; }
result
} }
pub fn has_durability(&self) -> bool { pub fn has_durability(&self) -> bool {

View File

@ -81,7 +81,6 @@ lazy_static! {
.map(|skill| { .map(|skill| {
let max_level = skill.max_level(); let max_level = skill.max_level();
(1..=max_level) (1..=max_level)
.into_iter()
.map(|level| skill.skill_cost(level)) .map(|level| skill.skill_cost(level))
.sum::<u16>() .sum::<u16>()
}) })

View File

@ -112,8 +112,7 @@ impl SkillSetBuilder {
pub fn with_skill(mut self, skill: Skill, level: u16) -> Self { pub fn with_skill(mut self, skill: Skill, level: u16) -> Self {
let Some(group) = skill.skill_group_kind() else { let Some(group) = skill.skill_group_kind() else {
let err = format!( let err = format!(
"Tried to add skill: {:?} which does not have an associated skill group.", "Tried to add skill: {skill:?} which does not have an associated skill group."
skill
); );
common_base::dev_panic!(err, or return self); common_base::dev_panic!(err, or return self);
}; };
@ -121,8 +120,7 @@ impl SkillSetBuilder {
let SkillSetBuilder(ref mut skill_set) = self; let SkillSetBuilder(ref mut skill_set) = self;
if skill_is_applied(skill_set, skill, level) { if skill_is_applied(skill_set, skill, level) {
let err = format!( let err = format!(
"Tried to add skill: {:?} with level {:?} which is already applied", "Tried to add skill: {skill:?} with level {level:?} which is already applied"
skill, level,
); );
common_base::dev_panic!(err, or return self); common_base::dev_panic!(err, or return self);
} }
@ -135,9 +133,8 @@ impl SkillSetBuilder {
} }
if !skill_is_applied(skill_set, skill, level) { if !skill_is_applied(skill_set, skill, level) {
let err = format!( let err = format!(
"Failed to add skill: {:?}. Verify that it has the appropriate skill group \ "Failed to add skill: {skill:?}. Verify that it has the appropriate skill group \
available and meets all prerequisite skills.", available and meets all prerequisite skills."
skill
); );
common_base::dev_panic!(err); common_base::dev_panic!(err);
} }

View File

@ -1,8 +1,9 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum::EnumIter; use strum::EnumIter;
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, EnumIter)] #[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, EnumIter)]
pub enum BiomeKind { pub enum BiomeKind {
#[default]
Void, Void,
Lake, Lake,
Grassland, Grassland,
@ -16,7 +17,3 @@ pub enum BiomeKind {
Savannah, Savannah,
Taiga, Taiga,
} }
impl Default for BiomeKind {
fn default() -> BiomeKind { BiomeKind::Void }
}

View File

@ -1,11 +1,12 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum SiteKindMeta { pub enum SiteKindMeta {
Dungeon(DungeonKindMeta), Dungeon(DungeonKindMeta),
Cave, Cave,
Settlement(SettlementKindMeta), Settlement(SettlementKindMeta),
Castle, Castle,
#[default]
Void, Void,
} }
@ -22,7 +23,3 @@ pub enum SettlementKindMeta {
DesertCity, DesertCity,
SavannahPit, SavannahPit,
} }
impl Default for SiteKindMeta {
fn default() -> SiteKindMeta { SiteKindMeta::Void }
}

View File

@ -321,7 +321,7 @@ macro_rules! make_case_elim {
elim.reduce(((self,), context)) elim.reduce(((self,), context))
} }
pub fn elim_case_pure<'a, 'b, Type>(&'a self, cases: &'b $mod::PureCases<Type>) -> &'b Type pub fn elim_case_pure<'a, Type>(&self, cases: &'a $mod::PureCases<Type>) -> &'a Type
{ {
let (expr, ()) = self.elim(cases, ()); let (expr, ()) = self.elim(cases, ());
expr expr
@ -425,7 +425,7 @@ macro_rules! make_proj_elim {
elim.reduce(((self,), context)) elim.reduce(((self,), context))
} }
pub fn elim_proj_pure<'a, 'b, Type>(&'a self, cases: &'b $mod::PureProj<Type>) -> &'b Type pub fn elim_proj_pure<'a, Type>(&self, cases: &'a $mod::PureProj<Type>) -> &'a Type
{ {
let (expr, ()) = self.elim(cases, ()); let (expr, ()) = self.elim(cases, ());
expr expr

View File

@ -1 +1 @@
nightly-2022-11-28 nightly-2023-04-20

View File

@ -786,7 +786,6 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
}) })
.and_then(|r| { .and_then(|r| {
let items = (0..amount) let items = (0..amount)
.into_iter()
.filter_map(|_| { .filter_map(|_| {
r.craft_simple( r.craft_simple(
&mut inventory, &mut inventory,

View File

@ -110,7 +110,6 @@ impl<'a> System<'a> for Sys {
.get_key_arc_real(chunk_key) .get_key_arc_real(chunk_key)
.map(|chunk| (Arc::clone(chunk), chunk_key, meta)) .map(|chunk| (Arc::clone(chunk), chunk_key, meta))
}) })
.into_iter()
.peekable(); .peekable();
while chunks_iter.peek().is_some() { while chunks_iter.peek().is_some() {

View File

@ -6,7 +6,6 @@
array_methods, array_methods,
array_zip, array_zip,
drain_filter, drain_filter,
once_cell,
trait_alias, trait_alias,
option_get_or_insert_default, option_get_or_insert_default,
map_try_insert, map_try_insert,

View File

@ -70,12 +70,13 @@ pub trait Vertex: Clone + bytemuck::Pod {
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Anti-aliasing modes /// Anti-aliasing modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum AaMode { pub enum AaMode {
/// Fast approximate antialiasing. /// Fast approximate antialiasing.
/// ///
/// This is a screen-space technique, and therefore works fine with greedy /// This is a screen-space technique, and therefore works fine with greedy
/// meshing. /// meshing.
#[default]
Fxaa, Fxaa,
/// Multisampling AA, up to 4 samples per pixel. /// Multisampling AA, up to 4 samples per pixel.
/// ///
@ -121,12 +122,8 @@ impl AaMode {
} }
} }
impl Default for AaMode {
fn default() -> Self { AaMode::Fxaa }
}
/// Cloud modes /// Cloud modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum CloudMode { pub enum CloudMode {
/// No clouds. As cheap as it gets. /// No clouds. As cheap as it gets.
None, None,
@ -144,6 +141,7 @@ pub enum CloudMode {
Ultra, Ultra,
/// Lots of detail with good-but-costly derivation of parameters. /// Lots of detail with good-but-costly derivation of parameters.
#[serde(other)] #[serde(other)]
#[default]
High, High,
} }
@ -151,12 +149,8 @@ impl CloudMode {
pub fn is_enabled(&self) -> bool { *self != CloudMode::None } pub fn is_enabled(&self) -> bool { *self != CloudMode::None }
} }
impl Default for CloudMode {
fn default() -> Self { CloudMode::High }
}
/// Fluid modes /// Fluid modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum FluidMode { pub enum FluidMode {
/// "Low" water. This water implements no waves, no reflections, no /// "Low" water. This water implements no waves, no reflections, no
/// diffraction, and no light attenuation through water. As a result, /// diffraction, and no light attenuation through water. As a result,
@ -180,32 +174,26 @@ pub enum FluidMode {
/// which causes attenuation to be computed incorrectly; this can be /// which causes attenuation to be computed incorrectly; this can be
/// addressed by using shadow maps (at least for terrain). /// addressed by using shadow maps (at least for terrain).
#[serde(other)] #[serde(other)]
#[default]
Medium, Medium,
} }
impl Default for FluidMode {
fn default() -> Self { FluidMode::Medium }
}
/// Reflection modes /// Reflection modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum ReflectionMode { pub enum ReflectionMode {
/// No or minimal reflections. /// No or minimal reflections.
Low, Low,
/// High quality reflections with screen-space raycasting and /// High quality reflections with screen-space raycasting and
/// all the bells & whistles. /// all the bells & whistles.
#[default]
High, High,
// Medium quality screen-space reflections. // Medium quality screen-space reflections.
#[serde(other)] #[serde(other)]
Medium, Medium,
} }
impl Default for ReflectionMode {
fn default() -> Self { ReflectionMode::High }
}
/// Lighting modes /// Lighting modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum LightingMode { pub enum LightingMode {
/// Ashikhmin-Shirley BRDF lighting model. Attempts to generate a /// Ashikhmin-Shirley BRDF lighting model. Attempts to generate a
/// physically plausible (to some extent) lighting distribution. /// physically plausible (to some extent) lighting distribution.
@ -222,13 +210,10 @@ pub enum LightingMode {
/// Standard Blinn-Phong shading, combing Lambertian diffuse reflections and /// Standard Blinn-Phong shading, combing Lambertian diffuse reflections and
/// specular highlights. /// specular highlights.
#[serde(other)] #[serde(other)]
#[default]
BlinnPhong, BlinnPhong,
} }
impl Default for LightingMode {
fn default() -> Self { LightingMode::BlinnPhong }
}
/// Shadow map settings. /// Shadow map settings.
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
pub struct ShadowMapMode { pub struct ShadowMapMode {
@ -314,7 +299,7 @@ impl From<PresentMode> for wgpu::PresentMode {
/// Bloom factor /// Bloom factor
/// Controls fraction of output image luminosity that is blurred bloom /// Controls fraction of output image luminosity that is blurred bloom
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Default, PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum BloomFactor { pub enum BloomFactor {
Low, Low,
High, High,
@ -322,13 +307,10 @@ pub enum BloomFactor {
Custom(f32), Custom(f32),
// other variant has to be placed last // other variant has to be placed last
#[serde(other)] #[serde(other)]
#[default]
Medium, Medium,
} }
impl Default for BloomFactor {
fn default() -> Self { Self::Medium }
}
impl BloomFactor { impl BloomFactor {
/// Fraction of output image luminosity that is blurred bloom /// Fraction of output image luminosity that is blurred bloom
pub fn fraction(self) -> f32 { pub fn fraction(self) -> f32 {

View File

@ -1359,16 +1359,14 @@ impl Window {
pub fn scale_factor(&self) -> f64 { self.scale_factor } pub fn scale_factor(&self) -> f64 { self.scale_factor }
} }
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)] #[derive(Default, Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)]
pub enum FullscreenMode { pub enum FullscreenMode {
Exclusive, Exclusive,
#[serde(other)] #[serde(other)]
#[default]
Borderless, Borderless,
} }
impl Default for FullscreenMode {
fn default() -> Self { FullscreenMode::Borderless }
}
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] #[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
pub struct FullScreenSettings { pub struct FullScreenSettings {

View File

@ -1190,10 +1190,7 @@ fn main() {
if !SKIP_VOLGRID { if !SKIP_VOLGRID {
let _ = volgrid.insert(spiralpos, Arc::new(chunk)); let _ = volgrid.insert(spiralpos, Arc::new(chunk));
if (1usize..20) if (1usize..20).any(|i| (2 * i + 1) * (2 * i + 1) == count) {
.into_iter()
.any(|i| (2 * i + 1) * (2 * i + 1) == count)
{
use std::fs::File; use std::fs::File;
let mut f = File::create(&format!("chonkjpegs/{}_{}.jpg", sitename, count)) let mut f = File::create(&format!("chonkjpegs/{}_{}.jpg", sitename, count))
.unwrap(); .unwrap();

View File

@ -85,12 +85,9 @@ fn generate(db_path: &str, ymin: Option<i32>, ymax: Option<i32>) -> Result<(), B
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
rayon::spawn(move || { rayon::spawn(move || {
let coords: Vec<_> = (ymin.unwrap_or(1)..ymax.unwrap_or(sz.y as i32)) let coords: Vec<_> = (ymin.unwrap_or(1)..ymax.unwrap_or(sz.y as i32))
.into_iter()
.flat_map(move |y| { .flat_map(move |y| {
let tx = tx.clone(); let tx = tx.clone();
(1..sz.x as i32) (1..sz.x as i32).map(move |x| (tx.clone(), x, y))
.into_iter()
.map(move |x| (tx.clone(), x, y))
}) })
.collect(); .collect();
coords.into_par_iter().for_each(|(tx, x, y)| { coords.into_par_iter().for_each(|(tx, x, y)| {

View File

@ -218,7 +218,6 @@ pub fn local_cells(map_size_lg: MapSizeLg, posi: usize) -> impl Clone + Iterator
let grid_size = 3i32; let grid_size = 3i32;
let grid_bounds = 2 * grid_size + 1; let grid_bounds = 2 * grid_size + 1;
(0..grid_bounds * grid_bounds) (0..grid_bounds * grid_bounds)
.into_iter()
.map(move |index| { .map(move |index| {
Vec2::new( Vec2::new(
pos.x + (index % grid_bounds) - grid_size, pos.x + (index % grid_bounds) - grid_size,

View File

@ -948,7 +948,7 @@ pub fn inscribed_polystar(
use std::f32::consts::TAU; use std::f32::consts::TAU;
let rpos: Vec2<f32> = pos.xy().as_() - origin.as_(); let rpos: Vec2<f32> = pos.xy().as_() - origin.as_();
let is_border = rpos.magnitude_squared() > (radius - 2.0).powi(2); let is_border = rpos.magnitude_squared() > (radius - 2.0).powi(2);
let is_line = (0..sides).into_iter().any(|i| { let is_line = (0..sides).any(|i| {
let f = |j: f32| { let f = |j: f32| {
let t = j * TAU / sides as f32; let t = j * TAU / sides as f32;
radius * Vec2::new(t.cos(), t.sin()) radius * Vec2::new(t.cos(), t.sin())

View File

@ -112,7 +112,6 @@ impl GnarlingFortification {
let num_points = (wall_radius / 15).max(5); let num_points = (wall_radius / 15).max(5);
let outer_wall_corners = (0..num_points) let outer_wall_corners = (0..num_points)
.into_iter()
.map(|a| { .map(|a| {
let angle = a as f32 / num_points as f32 * core::f32::consts::TAU; 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) Vec2::new(angle.cos(), angle.sin()).map(|a| (a * wall_radius as f32) as i32)
@ -448,7 +447,6 @@ impl Structure for GnarlingFortification {
const SECTIONS_PER_WALL_SEGMENT: usize = 8; const SECTIONS_PER_WALL_SEGMENT: usize = 8;
(0..(SECTIONS_PER_WALL_SEGMENT as i32)) (0..(SECTIONS_PER_WALL_SEGMENT as i32))
.into_iter()
.map(move |a| { .map(move |a| {
let get_point = let get_point =
|a| point + (next_point - point) * a / (SECTIONS_PER_WALL_SEGMENT as i32); |a| point + (next_point - point) * a / (SECTIONS_PER_WALL_SEGMENT as i32);