diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2024-10-11 23:57:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-11 23:57:44 -0400 |
| commit | 02cf62c59622de77888a087ca65cfcef69892a72 (patch) | |
| tree | de992d5e885060d0e995ec2ac3c1756db55c736a /compiler/rustc_codegen_llvm/src | |
| parent | 3f9aa50b70e8833656d557aa963e339faca0a4c6 (diff) | |
| parent | a278f157241e296ced392a81be5be7e8f608bd3c (diff) | |
| download | rust-02cf62c59622de77888a087ca65cfcef69892a72.tar.gz rust-02cf62c59622de77888a087ca65cfcef69892a72.zip | |
Rollup merge of #130962 - nyurik:opts-libs, r=cuviper
Migrate lib's `&Option<T>` into `Option<&T>` Trying out my new lint https://github.com/rust-lang/rust-clippy/pull/13336 - according to the [video](https://www.youtube.com/watch?v=6c7pZYP_iIE), this could lead to some performance and memory optimizations. Basic thoughts expressed in the video that seem to make sense: * `&Option<T>` in an API breaks encapsulation: * caller must own T and move it into an Option to call with it * if returned, the owner must store it as Option<T> internally in order to return it * Performance is subject to compiler optimization, but at the basics, `&Option<T>` points to memory that has `presence` flag + value, whereas `Option<&T>` by specification is always optimized to a single pointer.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
