Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth

Don't trigger `same_item_push` if the vec is used in the loop body

fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body
This commit is contained in:
bors 2021-04-05 22:57:33 +00:00
commit 57406c93df
2 changed files with 91 additions and 53 deletions

View file

@ -148,4 +148,11 @@ fn main() {
};
vec.push(item);
}
// Fix #6987
let mut vec = Vec::new();
for _ in 0..10 {
vec.push(1);
vec.extend(&[2]);
}
}