#[inline]
ing adjustments and minor syntax/formatting changes
#2016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added the
#[inline]
attribute to functions that could use it, and removed it from functions where it could do harm, or wasn't doing anything. The attribute is only useful to allow for the compiler to inline functions across a crate boundry.For reference:
#[inline]
on methods of error types is always a bad idea, as these are supposed to be exceptional states. In this case it could actually do harm, as it would increase code size for paths that are almost never taken and slightly increase compile times (because the compiler won't be able to compile our crate and their crate in parallel, if they make use of the methods).impl Debug
s with similar reasoning, but this can do no harm since you don't need to debug-print in production (I hope).I also made some syntactical changes here and there, mainly I removed needless dereferencing followed by
ref
-matching. For this I also added theCopy
trait for all SPIR-V types, so we don't need to deal with a bunch of referencing and dereferencing. Kind of like how allash
types areCopy
.Other than that, I took the liberty to do some minor changes to formatting as I was looking through the codebase, hopefully you don't mind. Mainly I made sure that lines don't exceed the rustfmt limit of 100 columns, and that doc comments use correct formatting.
All in all the intention was to hopefully make the code a bit cleaner. It's all in one humongous commit because I didn't have anything specific in mind as I was going through it all other than the inlining, so my apologies. Hopefully it's not too big of a hassle to review.