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>) {
let usernames = match count {
Some(n) => (0..n)
.into_iter()
.map(|i| format!("{}{:03}", prefix, i))
.collect::<Vec<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
/// not already reset.
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.

View File

@ -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 {
let result = match self {
match self {
// Using tool and toolkind to sort tools by kind
ItemKind::Tool(tool) => format!("Tool: {:?}", tool.kind),
ItemKind::ModularComponent(modular_component) => {
@ -346,8 +346,7 @@ 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 {

View File

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

View File

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

View File

@ -1,8 +1,9 @@
use serde::{Deserialize, Serialize};
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 {
#[default]
Void,
Lake,
Grassland,
@ -16,7 +17,3 @@ pub enum BiomeKind {
Savannah,
Taiga,
}
impl Default for BiomeKind {
fn default() -> BiomeKind { BiomeKind::Void }
}

View File

@ -1,11 +1,12 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Default, Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum SiteKindMeta {
Dungeon(DungeonKindMeta),
Cave,
Settlement(SettlementKindMeta),
Castle,
#[default]
Void,
}
@ -22,7 +23,3 @@ pub enum SettlementKindMeta {
DesertCity,
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))
}
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, ());
expr
@ -425,7 +425,7 @@ macro_rules! make_proj_elim {
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, ());
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| {
let items = (0..amount)
.into_iter()
.filter_map(|_| {
r.craft_simple(
&mut inventory,

View File

@ -110,7 +110,6 @@ 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() {

View File

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

View File

@ -70,12 +70,13 @@ pub trait Vertex: Clone + bytemuck::Pod {
use serde::{Deserialize, Serialize};
/// Anti-aliasing modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Default, 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.
///
@ -121,12 +122,8 @@ impl AaMode {
}
}
impl Default for AaMode {
fn default() -> Self { AaMode::Fxaa }
}
/// Cloud modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
pub enum CloudMode {
/// No clouds. As cheap as it gets.
None,
@ -144,6 +141,7 @@ pub enum CloudMode {
Ultra,
/// Lots of detail with good-but-costly derivation of parameters.
#[serde(other)]
#[default]
High,
}
@ -151,12 +149,8 @@ impl CloudMode {
pub fn is_enabled(&self) -> bool { *self != CloudMode::None }
}
impl Default for CloudMode {
fn default() -> Self { CloudMode::High }
}
/// Fluid modes
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Default, 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,
@ -180,32 +174,26 @@ 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(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Default, 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(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Default, 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.
@ -222,13 +210,10 @@ 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 {
@ -314,7 +299,7 @@ impl From<PresentMode> for wgpu::PresentMode {
/// Bloom factor
/// 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 {
Low,
High,
@ -322,13 +307,10 @@ 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 {

View File

@ -1359,16 +1359,14 @@ impl Window {
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 {
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 {

View File

@ -1190,10 +1190,7 @@ fn main() {
if !SKIP_VOLGRID {
let _ = volgrid.insert(spiralpos, Arc::new(chunk));
if (1usize..20)
.into_iter()
.any(|i| (2 * i + 1) * (2 * i + 1) == count)
{
if (1usize..20).any(|i| (2 * i + 1) * (2 * i + 1) == count) {
use std::fs::File;
let mut f = File::create(&format!("chonkjpegs/{}_{}.jpg", sitename, count))
.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();
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)
.into_iter()
.map(move |x| (tx.clone(), x, y))
(1..sz.x as i32).map(move |x| (tx.clone(), x, y))
})
.collect();
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_bounds = 2 * grid_size + 1;
(0..grid_bounds * grid_bounds)
.into_iter()
.map(move |index| {
Vec2::new(
pos.x + (index % grid_bounds) - grid_size,

View File

@ -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).into_iter().any(|i| {
let is_line = (0..sides).any(|i| {
let f = |j: f32| {
let t = j * TAU / sides as f32;
radius * Vec2::new(t.cos(), t.sin())

View File

@ -112,7 +112,6 @@ 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)
@ -448,7 +447,6 @@ 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);