rust-clippy/clippy_lints
Ryan Cumming 58459abd0c Allow pass by reference if we return a reference
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.
2018-07-23 18:44:40 +10:00
..
src Allow pass by reference if we return a reference 2018-07-23 18:44:40 +10:00
Cargo.toml Update dependencies 2018-07-20 00:50:02 -07:00
README.md Fix crates.io site name 2017-12-15 00:33:23 +02:00

This crate contains Clippy lints. For the main crate, check crates.io or GitHub.