mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
Ignore the IntoIterator::into_iter
call from for loops in significant_drop_in_scrutinee
This commit is contained in:
parent
526f02ef05
commit
95b78799c3
@ -89,6 +89,10 @@ fn has_significant_drop_in_scrutinee<'tcx, 'a>(
|
||||
source: MatchSource,
|
||||
) -> Option<(Vec<FoundSigDrop>, &'static str)> {
|
||||
let mut helper = SigDropHelper::new(cx);
|
||||
let scrutinee = match (source, &scrutinee.kind) {
|
||||
(MatchSource::ForLoopDesugar, ExprKind::Call(_, [e])) => e,
|
||||
_ => scrutinee,
|
||||
};
|
||||
helper.find_sig_drop(scrutinee).map(|drops| {
|
||||
let message = if source == MatchSource::Normal {
|
||||
"temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression"
|
||||
|
@ -620,4 +620,11 @@ fn should_trigger_lint_without_significant_drop_in_arm() {
|
||||
};
|
||||
}
|
||||
|
||||
fn should_not_trigger_on_significant_iterator_drop() {
|
||||
let lines = std::io::stdin().lines();
|
||||
for line in lines {
|
||||
println!("foo: {}", line.unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user