This code:
#[derive(Copy, Clone)]
struct OuterStruct {
field: [u8; 8],
}
fn return_inner(outer: &OuterStruct) -> &[u8] {
&outer.field
}
Produces:
this argument is passed by reference, but would be more efficient if passed by value
However, the outer cannot be passed by value as then it would not live long enough to return a reference to the field.
The code this was extracted from could either return a reference to the passed struct or from self. It cannot simply copy the field on return.