mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
58459abd0c
Currently this code will trigger `trivally_copy_pass_by_ref`: ``` struct OuterStruct { field: [u8; 8], } fn return_inner(outer: &OuterStruct) -> &[u8] { &outer.field } ``` If we change the `outer` to be pass-by-value it will not live long enough for us to return the reference. The above example is trivial but I've hit this in real code that either returns a reference to either the argument or in to `self`. This suppresses the `trivally_copy_pass_by_ref` lint if we return a reference and it has the same lifetime as the argument. This will likely miss complex cases with multiple lifetimes bounded by each other but it should cover the majority of cases with little effort. |
||
---|---|---|
.. | ||
auxiliary | ||
run-pass | ||
ui | ||
ui-toml | ||
camel_case.rs | ||
compile-test.rs | ||
dogfood.rs | ||
matches.rs | ||
needless_continue_helpers.rs | ||
trim_multiline.rs | ||
versioncheck.rs | ||
without_block_comments.rs |