Skip to content

Commit

Permalink
Merge pull request #954 from waywardmonkeys/make-rust-a-bit-better
Browse files Browse the repository at this point in the history
rust: Fix manual_slice_size_calculation lint.
  • Loading branch information
floooh authored Dec 9, 2023
2 parents c08a34d + 66739fd commit 9134aa1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bindgen/gen_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ def gen_helpers(inp):
if inp['prefix'] in ['sg_', 'sdtx_', 'sshape_', 'sapp_']:
l("/// Helper function to cast a rust slice into a sokol Range")
l(f"pub fn slice_as_range<T>(data: &[T]) -> {range_struct_name} {{")
l(f" {range_struct_name} {{ size: data.len() * std::mem::size_of::<T>(), ptr: data.as_ptr() as *const _ }}")
l(f" {range_struct_name} {{ size: std::mem::size_of_val(data), ptr: data.as_ptr() as *const _ }}")
l("}")
l("/// Helper function to cast a rust reference into a sokol Range")
l(f"pub fn value_as_range<T>(value: &T) -> {range_struct_name} {{")
Expand Down

0 comments on commit 9134aa1

Please sign in to comment.