gpu-allocator icon indicating copy to clipboard operation
gpu-allocator copied to clipboard

AllocatorVisualizer could/should implement Default

Open RedBreadcat opened this issue 3 years ago • 1 comments

Hello, First of all, thank you for the excellent library.

The AllocatorVisualizer struct (both DX12 and Vulkan) are created using the new() function, which notably has no arguments. One might expect it to implement Default for this reason, but it does not. There's a clippy lint for this: https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default The Rust API guidelines recommend the same: https://rust-lang.github.io/api-guidelines/interoperability.html

RedBreadcat avatar Mar 13 '22 03:03 RedBreadcat

Surprisingly src/{d3d12,vulkan}/visualizer.rs allow this lint at the top:

https://github.com/Traverse-Research/gpu-allocator/blob/ea9b3c859709c1322a3783008e7ef5bdb1d74ad5/src/d3d12/visualizer.rs#L1

https://github.com/Traverse-Research/gpu-allocator/blob/ea9b3c859709c1322a3783008e7ef5bdb1d74ad5/src/vulkan/visualizer.rs#L1

Perhaps those should be removed and the resulting clippy lints fixed? I don't see a compelling reason to omit this lint - feel free to open a PR!

MarijnS95 avatar Mar 14 '22 11:03 MarijnS95