Fix compiler warnings.

This commit is contained in:
Nathan Vegdahl 2018-03-04 13:06:22 -08:00
parent 97d3304149
commit c990672dfe
5 changed files with 7 additions and 7 deletions

View File

@ -56,7 +56,7 @@ impl<'a> BVH4<'a> {
} else { } else {
let base = BVHBase::from_objects(objects, objects_per_leaf, bounder); let base = BVHBase::from_objects(objects, objects_per_leaf, bounder);
let mut root = unsafe { arena.alloc_uninitialized::<BVH4Node>() }; let root = unsafe { arena.alloc_uninitialized::<BVH4Node>() };
BVH4::construct_from_base(arena, &base, base.root_node_index(), root); BVH4::construct_from_base(arena, &base, base.root_node_index(), root);
BVH4 { BVH4 {
root: Some(root), root: Some(root),

View File

@ -73,7 +73,7 @@ impl<'a> LightTree<'a> {
let mut builder = LightTreeBuilder::new(); let mut builder = LightTreeBuilder::new();
builder.recursive_build(0, 0, objects, &info_getter); builder.recursive_build(0, 0, objects, &info_getter);
let mut root = unsafe { arena.alloc_uninitialized::<Node>() }; let root = unsafe { arena.alloc_uninitialized::<Node>() };
LightTree::construct_from_builder(arena, &builder, builder.root_node_index(), root); LightTree::construct_from_builder(arena, &builder, builder.root_node_index(), root);
LightTree { LightTree {
@ -105,7 +105,7 @@ impl<'a> LightTree<'a> {
let bounds = arena.copy_slice(&base.bounds[bounds_range.0..bounds_range.1]); let bounds = arena.copy_slice(&base.bounds[bounds_range.0..bounds_range.1]);
let child_count = base.node_child_count(node_index); let child_count = base.node_child_count(node_index);
let mut children = unsafe { arena.alloc_array_uninitialized::<Node>(child_count) }; let children = unsafe { arena.alloc_array_uninitialized::<Node>(child_count) };
for i in 0..child_count { for i in 0..child_count {
LightTree::construct_from_builder( LightTree::construct_from_builder(
arena, arena,

View File

@ -67,7 +67,7 @@ impl<'a> TriangleMesh<'a> {
}; };
// Copy triangle vertex indices over, appending the triangle index itself to the tuple // Copy triangle vertex indices over, appending the triangle index itself to the tuple
let mut indices = { let indices = {
let mut indices = unsafe { arena.alloc_array_uninitialized(tri_indices.len()) }; let mut indices = unsafe { arena.alloc_array_uninitialized(tri_indices.len()) };
for (i, tri_i) in tri_indices.iter().enumerate() { for (i, tri_i) in tri_indices.iter().enumerate() {
indices[i] = (tri_i.0 as u32, tri_i.2 as u32, tri_i.1 as u32, i as u32); indices[i] = (tri_i.0 as u32, tri_i.2 as u32, tri_i.1 as u32, i as u32);

View File

@ -114,7 +114,7 @@ impl<'a> TracerInner<'a> {
&mut [], &mut [],
] ]
}; };
let mut ray_sets = if inst.transform_indices.is_some() { let ray_sets = if inst.transform_indices.is_some() {
&mut tmp[..] &mut tmp[..]
} else { } else {
&mut tmp[..1] &mut tmp[..1]

View File

@ -105,7 +105,7 @@ impl MemArena {
/// Allocates memory for and initializes a type T, returning a mutable reference to it. /// Allocates memory for and initializes a type T, returning a mutable reference to it.
pub fn alloc<'a, T: Copy>(&'a self, value: T) -> &'a mut T { pub fn alloc<'a, T: Copy>(&'a self, value: T) -> &'a mut T {
let mut memory = unsafe { self.alloc_uninitialized() }; let memory = unsafe { self.alloc_uninitialized() };
*memory = value; *memory = value;
memory memory
} }
@ -115,7 +115,7 @@ impl MemArena {
/// Additionally, the allocation will be made with the given byte alignment or /// Additionally, the allocation will be made with the given byte alignment or
/// the type's inherent alignment, whichever is greater. /// the type's inherent alignment, whichever is greater.
pub fn alloc_with_alignment<'a, T: Copy>(&'a self, value: T, align: usize) -> &'a mut T { pub fn alloc_with_alignment<'a, T: Copy>(&'a self, value: T, align: usize) -> &'a mut T {
let mut memory = unsafe { self.alloc_uninitialized_with_alignment(align) }; let memory = unsafe { self.alloc_uninitialized_with_alignment(align) };
*memory = value; *memory = value;
memory memory
} }