]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | use std::collections::HashSet; |
2 | ||
3 | // See rust-lang/rust-clippy#2774. | |
4 | ||
5 | #[derive(Eq, PartialEq, Debug, Hash)] | |
6 | pub struct Bar { | |
7 | foo: Foo, | |
8 | } | |
9 | ||
10 | #[derive(Eq, PartialEq, Debug, Hash)] | |
04454e1e | 11 | pub struct Foo; |
f20569fa XL |
12 | |
13 | #[allow(clippy::implicit_hasher)] | |
14 | // This should not cause a "cannot relate bound region" ICE. | |
15 | pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) { | |
781aab86 FG |
16 | //~^ ERROR: the following explicit lifetimes could be elided: 'a |
17 | //~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings` | |
f20569fa XL |
18 | let mut foos = HashSet::new(); |
19 | foos.extend(bars.iter().map(|b| &b.foo)); | |
20 | } | |
21 | ||
22 | #[allow(clippy::implicit_hasher)] | |
23 | // Also, this should not cause a "cannot relate bound region" ICE. | |
24 | pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) { | |
25 | let mut foos = HashSet::new(); | |
26 | foos.extend(bars.iter().map(|b| &b.foo)); | |
27 | } | |
28 | ||
29 | fn main() {} |