2019-11-01 06:04:31 -05:00
|
|
|
// run-pass
|
|
|
|
// run-rustfix
|
2021-06-25 12:26:31 -05:00
|
|
|
// rustfix-only-machine-applicable
|
2019-11-01 06:04:31 -05:00
|
|
|
|
2022-01-13 07:57:57 -06:00
|
|
|
#[allow(unused_must_use)]
|
2019-11-01 06:04:31 -05:00
|
|
|
fn main() {
|
|
|
|
let small = [1, 2];
|
|
|
|
let big = [0u8; 33];
|
|
|
|
|
|
|
|
// Expressions that should trigger the lint
|
|
|
|
small.into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-11-01 06:04:31 -05:00
|
|
|
[1, 2].into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-11-01 06:04:31 -05:00
|
|
|
big.into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-11-01 06:04:31 -05:00
|
|
|
[0u8; 33].into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-11-01 06:04:31 -05:00
|
|
|
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new(small).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new([1, 2]).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new(big).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new([0u8; 33]).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
|
|
|
|
Box::new(Box::new(small)).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new(Box::new([1, 2])).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new(Box::new(big)).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-12-22 07:26:28 -06:00
|
|
|
Box::new(Box::new([0u8; 33])).into_iter();
|
2021-05-25 10:56:19 -05:00
|
|
|
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
|
2021-06-15 10:16:21 -05:00
|
|
|
//~| WARNING this changes meaning
|
2019-11-01 06:04:31 -05:00
|
|
|
|
|
|
|
// Expressions that should not
|
|
|
|
(&[1, 2]).into_iter();
|
|
|
|
(&small).into_iter();
|
|
|
|
(&[0u8; 33]).into_iter();
|
|
|
|
(&big).into_iter();
|
|
|
|
|
|
|
|
for _ in &[1, 2] {}
|
|
|
|
(&small as &[_]).into_iter();
|
|
|
|
small[..].into_iter();
|
|
|
|
std::iter::IntoIterator::into_iter(&[1, 2]);
|
2020-10-19 10:50:36 -05:00
|
|
|
|
|
|
|
#[allow(array_into_iter)]
|
|
|
|
[0, 1].into_iter();
|
2019-11-01 06:04:31 -05:00
|
|
|
}
|