fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1use std::collections::HashSet; 2 3// See rust-lang/rust-clippy#2774. 4 5#[derive(Eq, PartialEq, Debug, Hash)] 6pub struct Bar { 7 foo: Foo, 8} 9 10#[derive(Eq, PartialEq, Debug, Hash)] 11pub struct Foo; 12 13#[allow(clippy::implicit_hasher)] 14// This should not cause a "cannot relate bound region" ICE. 15pub fn add_barfoos_to_foos(bars: &HashSet<&Bar>) { 16 //~^ ERROR: the following explicit lifetimes could be elided: 'a 17 //~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings` 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. 24pub 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 29fn main() {}