Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
trivially_copy_pass_by_ref
conditional on a 64-bit target. (#77)
Consider the following code: ```rust #[derive(Copy, Clone)] struct Foo { a: usize, b: usize, c: usize, } fn take_foo(foo: &Foo) {} ```` When targeting 64-bit `Foo` is 24 bytes and so doesn't trigger `trivially_copy_pass_by_ref` for `take_foo`. However when targeting 32-bit `Foo` is 12 bytes, which is below our threshold of 16 bytes, and triggers the lint. Satisfying the lint doesn't make sense in the larger picture though, because `Foo` is still 24 bytes in the 64-bit world. I ran into this issue in practice when adding our lint set to [SimpleCSS](https://github.com/linebender/simplecss). Unfortunately our custom `trivial-copy-size-limit` can't be a multiplier of `target_pointer_width` even though the default value does that. So the solution is to make the lint apply only when targeting 64-bit. Can't do that in `Cargo.toml` so `lib.rs` it is. Luckily we don't care as much about this lint in the examples so it works out fine.
- Loading branch information