Fix 1.88.0 clippy warnings

This commit is contained in:
Matthias Schiffer 2025-06-29 17:05:59 +02:00
parent ec4fd79864
commit 64e7375f2f
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
6 changed files with 14 additions and 17 deletions

View file

@ -20,7 +20,7 @@ fn main() -> Result<()> {
let args = Args::parse();
let value: fastnbt::Value = minedmap_nbt::data::from_file(args.file.as_path())?;
println!("{:#x?}", value);
println!("{value:#x?}");
Ok(())
}

View file

@ -21,7 +21,7 @@ fn main() -> Result<()> {
minedmap_nbt::region::from_file(args.file.as_path())?.foreach_chunk(
|coords, value: fastnbt::Value| {
println!("Chunk {:?}: {:#x?}", coords, value);
println!("Chunk {coords:?}: {value:#x?}");
Ok(())
},
)

View file

@ -124,7 +124,7 @@ impl<R: Read + Seek> Region<R> {
let mut len_buf = [0u8; 4];
reader
.read_exact(&mut len_buf)
.with_context(|| format!("Failed to read length for chunk {:?}", coords))?;
.with_context(|| format!("Failed to read length for chunk {coords:?}"))?;
let byte_len = u32::from_be_bytes(len_buf) as usize;
if byte_len < 1 || byte_len > (len as usize) * BLOCKSIZE - 4 {
bail!("Invalid length for chunk {:?}", coords);
@ -133,9 +133,9 @@ impl<R: Read + Seek> Region<R> {
let mut buffer = vec![0; byte_len];
reader
.read_exact(&mut buffer)
.with_context(|| format!("Failed to read data for chunk {:?}", coords))?;
.with_context(|| format!("Failed to read data for chunk {coords:?}"))?;
let chunk = decode_chunk(&buffer)
.with_context(|| format!("Failed to decode data for chunk {:?}", coords))?;
.with_context(|| format!("Failed to decode data for chunk {coords:?}"))?;
f(coords, chunk)?;
}

View file

@ -237,7 +237,7 @@ impl Config {
fn sign_transform(splitter: &Regex, transform: &str) -> Result<(Regex, String)> {
let captures = splitter
.captures(transform)
.with_context(|| format!("Invalid transform pattern '{}'", transform))?;
.with_context(|| format!("Invalid transform pattern '{transform}'"))?;
let regexp = Regex::new(&captures[1])?;
let replacement = captures[2].to_string();
Ok((regexp, replacement))
@ -275,7 +275,7 @@ impl Config {
TileKind::Map => "map",
TileKind::Lightmap => "light",
};
let dir = format!("{}/{}", prefix, level);
let dir = format!("{prefix}/{level}");
[&self.output_dir, Path::new(&dir)].iter().collect()
}

View file

@ -228,7 +228,7 @@ impl<'a> SingleRegionProcessor<'a> {
) -> Result<()> {
let (chunk, has_unknown) =
world::chunk::Chunk::new(&chunk_data, self.block_types, self.biome_types)
.with_context(|| format!("Failed to decode chunk {:?}", chunk_coords))?;
.with_context(|| format!("Failed to decode chunk {chunk_coords:?}"))?;
data.has_unknown |= has_unknown;
if self.output_needed || self.lightmap_needed {
@ -238,7 +238,7 @@ impl<'a> SingleRegionProcessor<'a> {
block_light,
depths,
}) = world::layer::top_layer(&mut data.biome_list, &chunk)
.with_context(|| format!("Failed to process chunk {:?}", chunk_coords))?
.with_context(|| format!("Failed to process chunk {chunk_coords:?}"))?
{
if self.output_needed {
data.chunks[chunk_coords] = Some(Box::new(ProcessedChunk {
@ -257,10 +257,7 @@ impl<'a> SingleRegionProcessor<'a> {
if self.entities_needed {
let mut block_entities = chunk.block_entities().with_context(|| {
format!(
"Failed to process block entities for chunk {:?}",
chunk_coords,
)
format!("Failed to process block entities for chunk {chunk_coords:?}")
})?;
data.entities.block_entities.append(&mut block_entities);
}
@ -407,7 +404,7 @@ impl<'a> RegionProcessor<'a> {
self.collect_regions()?.par_iter().try_for_each(|&coords| {
let ret = self
.process_region(coords)
.with_context(|| format!("Failed to process region {:?}", coords))?;
.with_context(|| format!("Failed to process region {coords:?}"))?;
if ret != Status::ErrorMissing {
region_send.send(coords).unwrap();

View file

@ -249,7 +249,7 @@ impl<'a> TileRenderer<'a> {
.filter(|entry| self.region_set.contains(entry))
})
.try_map(|entry| self.processed_source(entry))
.with_context(|| format!("Region {:?} from previous step must exist", coords))?;
.with_context(|| format!("Region {coords:?} from previous step must exist"))?;
let max_timestamp = *sources
.iter()
@ -293,7 +293,7 @@ impl<'a> TileRenderer<'a> {
let region_group = self
.rt
.block_on(self.load_region_group(processed_paths))
.with_context(|| format!("Region {:?} from previous step must be loadable", coords))?;
.with_context(|| format!("Region {coords:?} from previous step must be loadable"))?;
let mut image = image::RgbaImage::new(N, N);
Self::render_region(&mut image, &region_group);
@ -325,7 +325,7 @@ impl<'a> TileRenderer<'a> {
.map(|&coords| {
anyhow::Ok(usize::from(
self.render_tile(coords)
.with_context(|| format!("Failed to render tile {:?}", coords))?,
.with_context(|| format!("Failed to render tile {coords:?}"))?,
))
})
.try_reduce(|| 0, |a, b| Ok(a + b))?;