On Tue, Apr 15, 2025 at 07:08:42PM -0400, Tamir Duberstein wrote: [...]
also from the link document you shared, looks like the suggestion is to use core::ptr::from_{ref,mut}(), was this ever considered?
I considered it, but I thought it was ugly. We don't have a linter to enforce it, so I'd be surprised if people reached for it.
I think avoiding the extra line of `let` is a win, also I don't get why you feel it's *ugly*: having the extra `let` line is ugly to me ;-)
I admit it's subjective, so I'm happy to change it. But I've never seen that syntax used, and we lack enforcement for either one, so I don't find much value in arguing over this.
If the original code use "as" for conversion purposes, I think it's good to be consistent and using from_ref() or from_mut(): they are just bullet-proof version of conversions, and having a separate let statement looks like a distraction to me. If for new code, and the author has a reason for let statement, then it's fine.
Fine by me. I'll change the let statements to those methods on the next spin.
Thanks! There are a few instances in the early patches as well, appreciate it if you can change them as well.
Regards, Boqun
Thanks for your feedback. Tamir