1
Fork 0

Avoid Iterator::last

This commit is contained in:
KaDiWa 2022-09-11 17:23:00 +02:00
parent 6f0c4a6c5c
commit 66211d83f9
No known key found for this signature in database
GPG key ID: 0B52AE391C674CE5
7 changed files with 11 additions and 15 deletions

View file

@ -1309,10 +1309,8 @@ pub fn build_session(
let warnings_allow = sopts
.lint_opts
.iter()
.filter(|&&(ref key, _)| *key == "warnings")
.map(|&(_, ref level)| *level == lint::Allow)
.last()
.unwrap_or(false);
.rfind(|&&(ref key, _)| *key == "warnings")
.map_or(false, |&(_, level)| level == lint::Allow);
let cap_lints_allow = sopts.lint_cap.map_or(false, |cap| cap == lint::Allow);
let can_emit_warnings = !(warnings_allow || cap_lints_allow);