treewide: clippy fixes

Fix all clippy warnings as of Rust 1.83.0.
This commit is contained in:
Matthias Schiffer 2024-12-17 00:23:57 +01:00
parent 2156bff59a
commit 4933d8e15f
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
7 changed files with 16 additions and 16 deletions

View file

@ -18,7 +18,7 @@ use crate::{
world::{block_entity::BlockEntity, layer}, world::{block_entity::BlockEntity, layer},
}; };
/// Increase to force regeneration of all output files // Increase to force regeneration of all output files
/// MinedMap processed region data version number /// MinedMap processed region data version number
/// ///

View file

@ -16,7 +16,7 @@ pub struct EntityCollector<'a> {
regions: &'a [TileCoords], regions: &'a [TileCoords],
} }
impl<'a> TileMerger for EntityCollector<'a> { impl TileMerger for EntityCollector<'_> {
fn file_meta_version(&self) -> fs::FileMetaVersion { fn file_meta_version(&self) -> fs::FileMetaVersion {
ENTITIES_FILE_META_VERSION ENTITIES_FILE_META_VERSION
} }
@ -34,7 +34,7 @@ impl<'a> TileMerger for EntityCollector<'a> {
} }
} }
impl<'a> TileCollector for EntityCollector<'a> { impl TileCollector for EntityCollector<'_> {
type CollectOutput = (); type CollectOutput = ();
fn tiles(&self) -> &[TileCoords] { fn tiles(&self) -> &[TileCoords] {

View file

@ -74,7 +74,7 @@ impl<'a, P> MapMerger<'a, P> {
} }
} }
impl<'a, P: image::PixelWithColorType> TileMerger for MapMerger<'a, P> impl<P: image::PixelWithColorType> TileMerger for MapMerger<'_, P>
where where
[P::Subpixel]: image::EncodableLayout, [P::Subpixel]: image::EncodableLayout,
image::ImageBuffer<P, Vec<P::Subpixel>>: Into<image::DynamicImage>, image::ImageBuffer<P, Vec<P::Subpixel>>: Into<image::DynamicImage>,
@ -157,7 +157,7 @@ pub struct TileMipmapper<'a> {
regions: &'a [TileCoords], regions: &'a [TileCoords],
} }
impl<'a> TileCollector for TileMipmapper<'a> { impl TileCollector for TileMipmapper<'_> {
type CollectOutput = MipmapStat; type CollectOutput = MipmapStat;
fn tiles(&self) -> &[TileCoords] { fn tiles(&self) -> &[TileCoords] {

View file

@ -416,13 +416,13 @@ impl<'a> Iterator for SectionIter<'a> {
} }
} }
impl<'a> DoubleEndedIterator for SectionIter<'a> { impl DoubleEndedIterator for SectionIter<'_> {
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
self.with_iter(|iter| iter.next_back()) self.with_iter(|iter| iter.next_back())
} }
} }
impl<'a> ExactSizeIterator for SectionIter<'a> { impl ExactSizeIterator for SectionIter<'_> {
fn len(&self) -> usize { fn len(&self) -> usize {
match &self.inner { match &self.inner {
SectionIterInner::V1_18 { iter } => iter.len(), SectionIterInner::V1_18 { iter } => iter.len(),
@ -433,4 +433,4 @@ impl<'a> ExactSizeIterator for SectionIter<'a> {
} }
} }
impl<'a> FusedIterator for SectionIter<'a> {} impl FusedIterator for SectionIter<'_> {}

View file

@ -58,7 +58,7 @@ struct LayerEntry<'a> {
depth: &'a mut Option<BlockHeight>, depth: &'a mut Option<BlockHeight>,
} }
impl<'a> LayerEntry<'a> { impl LayerEntry<'_> {
/// Returns true if the entry has not been filled yet (no opaque block has been encountered) /// Returns true if the entry has not been filled yet (no opaque block has been encountered)
/// ///
/// The depth value is filled separately when a non-water block is encountered after the block type /// The depth value is filled separately when a non-water block is encountered after the block type

View file

@ -81,7 +81,7 @@ impl<'a> SectionV1_13<'a> {
if let Some(block_states) = block_states { if let Some(block_states) = block_states {
let expected_length = if aligned_blocks { let expected_length = if aligned_blocks {
let blocks_per_word = 64 / bits as usize; let blocks_per_word = 64 / bits as usize;
(4096 + blocks_per_word - 1) / blocks_per_word 4096usize.div_ceil(blocks_per_word)
} else { } else {
64 * bits as usize 64 * bits as usize
}; };
@ -145,7 +145,7 @@ impl<'a> SectionV1_13<'a> {
} }
} }
impl<'a> Section for SectionV1_13<'a> { impl Section for SectionV1_13<'_> {
fn block_at(&self, coords: SectionBlockCoords) -> Result<Option<&BlockType>> { fn block_at(&self, coords: SectionBlockCoords) -> Result<Option<&BlockType>> {
let index = self.palette_index_at(coords); let index = self.palette_index_at(coords);
Ok(*self Ok(*self
@ -188,7 +188,7 @@ impl<'a> SectionV0<'a> {
} }
} }
impl<'a> Section for SectionV0<'a> { impl Section for SectionV0<'_> {
fn block_at(&self, coords: SectionBlockCoords) -> Result<Option<&BlockType>> { fn block_at(&self, coords: SectionBlockCoords) -> Result<Option<&BlockType>> {
let offset = coords.offset(); let offset = coords.offset();
let block = self.blocks[offset] as u8; let block = self.blocks[offset] as u8;
@ -242,7 +242,7 @@ impl<'a> BiomesV1_18<'a> {
if let Some(biomes) = biomes { if let Some(biomes) = biomes {
let biomes_per_word = 64 / bits as usize; let biomes_per_word = 64 / bits as usize;
let expected_length = (64 + biomes_per_word - 1) / biomes_per_word; let expected_length = 64usize.div_ceil(biomes_per_word);
if biomes.len() != expected_length { if biomes.len() != expected_length {
bail!("Invalid section biome data"); bail!("Invalid section biome data");
} }
@ -294,7 +294,7 @@ impl<'a> BiomesV1_18<'a> {
} }
} }
impl<'a> Biomes for BiomesV1_18<'a> { impl Biomes for BiomesV1_18<'_> {
fn biome_at(&self, _section: SectionY, coords: SectionBlockCoords) -> Result<Option<&Biome>> { fn biome_at(&self, _section: SectionY, coords: SectionBlockCoords) -> Result<Option<&Biome>> {
let index = self.palette_index_at(coords); let index = self.palette_index_at(coords);
Ok(*self Ok(*self
@ -349,7 +349,7 @@ impl<'a> BiomesV0<'a> {
} }
} }
impl<'a> Biomes for BiomesV0<'a> { impl Biomes for BiomesV0<'_> {
fn biome_at(&self, section: SectionY, coords: SectionBlockCoords) -> Result<Option<&Biome>> { fn biome_at(&self, section: SectionY, coords: SectionBlockCoords) -> Result<Option<&Biome>> {
let id = match self.data { let id = match self.data {
BiomesV0Data::IntArrayV15(data) => { BiomesV0Data::IntArrayV15(data) => {

View file

@ -23,7 +23,7 @@ pub struct RawSignText<'a> {
pub color: Option<&'a str>, pub color: Option<&'a str>,
} }
impl<'a> RawSignText<'a> { impl RawSignText<'_> {
/// Decodes the [RawSignText] into a [SignText] /// Decodes the [RawSignText] into a [SignText]
pub fn decode(&self) -> SignText { pub fn decode(&self) -> SignText {
let color = self.color.map(|c| Arc::new(c.to_owned())); let color = self.color.map(|c| Arc::new(c.to_owned()));