Skip to content

Commit

Permalink
fixing clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyTornetta committed Sep 11, 2024
1 parent bd9c163 commit 4b1510d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
21 changes: 6 additions & 15 deletions cosmos_client/src/item/item_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ fn generate_item_model(
image_index.texture_index,
);

let Some(item_material_mapping) = item_materials_registry.get_value(item) else {
return None;
};
let item_material_mapping = item_materials_registry.get_value(item)?;
let mat_id = item_material_mapping.material_id();
let material = material_definitions_registry.from_numeric_id(mat_id);

Expand Down Expand Up @@ -291,9 +289,7 @@ fn generate_block_item_model(
.from_id(block.unlocalized_name())
.unwrap_or_else(|| block_textures.from_id("missing").expect("Missing texture should exist."));

let Some(block_mesh_info) = block_meshes.get_value(block) else {
return None;
};
let block_mesh_info = block_meshes.get_value(block)?;

let mut mesh_builder = CosmosMeshBuilder::default();

Expand Down Expand Up @@ -330,26 +326,21 @@ fn generate_block_item_model(
Vec3::ZERO,
Rect::new(0.0, 0.0, 1.0, 1.0),
image_index.texture_index,
material.add_material_data(block.id(), &mesh_info),
material.add_material_data(block.id(), mesh_info),
);
}

texture_dims.expect("Set above")
} else {
let Some(mesh_info) = block_mesh_info.info_for_whole_block() else {
return None;
};

let Some(image_index) = index.atlas_index_from_face(BlockFace::Front, BlockNeighbors::empty()) else {
return None;
};
let mesh_info = block_mesh_info.info_for_whole_block()?;
let image_index = index.atlas_index_from_face(BlockFace::Front, BlockNeighbors::empty())?;

mesh_builder.add_mesh_information(
mesh_info,
Vec3::ZERO,
Rect::new(0.0, 0.0, 1.0, 1.0),
image_index.texture_index,
material.add_material_data(block.id(), &mesh_info),
material.add_material_data(block.id(), mesh_info),
);

image_index.dimension_index
Expand Down
2 changes: 1 addition & 1 deletion cosmos_server/src/inventory/block_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn process_event(
return;
};

let Some(inventory_here) = structure.query_block_data(block.coords(), &q_inventory) else {
let Some(inventory_here) = structure.query_block_data(block.coords(), q_inventory) else {
return;
};

Expand Down

0 comments on commit 4b1510d

Please sign in to comment.