chore: remove some dump unwraps
we need to remove more
This commit is contained in:
parent
eb8931f5f3
commit
8b418813f8
@ -327,8 +327,8 @@ impl<S: SingleChunkDataSerializer> ChunkSerializer for LinearFile<S> {
|
||||
header.size = chunk_raw.len() as u32;
|
||||
header.timestamp = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs() as u32;
|
||||
.map(|d| d.as_secs() as u32)
|
||||
.unwrap_or(0);
|
||||
|
||||
// We update the data buffer
|
||||
self.chunks_data[index] = Some(chunk_raw);
|
||||
|
||||
@ -90,7 +90,7 @@ impl TreeFeature {
|
||||
|
||||
let clipped_height = self.minimum_size.min_clipped_height;
|
||||
let top = self.get_top(height, chunk, pos); // TODO: roots
|
||||
if top < height && (clipped_height.is_none() || top < clipped_height.unwrap() as u32) {
|
||||
if top < height && top < clipped_height.map_or(u32::MAX, |h| h as u32) {
|
||||
return vec![];
|
||||
}
|
||||
let trunk_state = self.trunk_provider.get(random, pos);
|
||||
|
||||
@ -62,14 +62,11 @@ pub async fn get_spread<T: FlowingFluid + Sync + ?Sized>(
|
||||
continue;
|
||||
}
|
||||
|
||||
let new_fluid_state = fluid_impl.get_new_liquid(world, fluid, &side_pos).await;
|
||||
|
||||
// Skip if no valid fluid state for this position
|
||||
if new_fluid_state.is_none() {
|
||||
let Some(new_fluid_props) = fluid_impl.get_new_liquid(world, fluid, &side_pos).await else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
let new_fluid_props = new_fluid_state.unwrap();
|
||||
let new_state_id = new_fluid_props.to_state_id(fluid);
|
||||
|
||||
// Holes get distance 0
|
||||
|
||||
@ -61,11 +61,7 @@ impl FindArg<'_> for TextComponentArgConsumer {
|
||||
}
|
||||
|
||||
fn parse_text_component(input: &str) -> Option<TextComponent> {
|
||||
let result = serde_json::from_str(input);
|
||||
if let Err(e) = result {
|
||||
debug!("Failed to parse text component: {e}");
|
||||
None
|
||||
} else {
|
||||
result.unwrap()
|
||||
}
|
||||
serde_json::from_str(input)
|
||||
.map_err(|e| debug!("Failed to parse text component: {e}"))
|
||||
.ok()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user