blob: 265a6c764d200408f7d24f58eb368d4e441ffd6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
//@ run-pass
//@ run-rustfix
//@ rustfix-only-machine-applicable
#[allow(unused_must_use, unused_allocation)]
fn main() {
let boxed = vec![1, 2].into_boxed_slice();
// Expressions that should trigger the lint
boxed.iter();
//~^ WARNING this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter`
//~| WARNING this changes meaning
Box::new(boxed.clone()).iter();
//~^ WARNING this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter`
//~| WARNING this changes meaning
Box::new(Box::new(boxed.clone())).iter();
//~^ WARNING this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter`
//~| WARNING this changes meaning
// Expressions that should not
(&boxed).into_iter();
for _ in &boxed {}
(&boxed as &[_]).into_iter();
boxed[..].into_iter();
std::iter::IntoIterator::into_iter(&boxed);
#[allow(boxed_slice_into_iter)]
boxed.into_iter();
}
|