about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
diff options
context:
space:
mode:
authorKaDiWa <kalle.wachsmuth@gmail.com>2022-09-11 17:23:00 +0200
committerKaDiWa <kalle.wachsmuth@gmail.com>2022-09-11 17:23:00 +0200
commit66211d83f9ad82770f2f81d37aae1544365a9a32 (patch)
tree6303abb18f7e6401d3e057db985e4ba005102eb1 /compiler/rustc_borrowck/src
parent6f0c4a6c5c36f1f8f433a12e10a29918f3d40a31 (diff)
downloadrust-66211d83f9ad82770f2f81d37aae1544365a9a32.tar.gz
rust-66211d83f9ad82770f2f81d37aae1544365a9a32.zip
Avoid `Iterator::last`
Diffstat (limited to 'compiler/rustc_borrowck/src')
-rw-r--r--compiler/rustc_borrowck/src/location.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/location.rs b/compiler/rustc_borrowck/src/location.rs
index 5ca3f2f4d03..877944d3d70 100644
--- a/compiler/rustc_borrowck/src/location.rs
+++ b/compiler/rustc_borrowck/src/location.rs
@@ -86,8 +86,7 @@ impl LocationTable {
         let (block, &first_index) = self
             .statements_before_block
             .iter_enumerated()
-            .filter(|(_, first_index)| **first_index <= point_index)
-            .last()
+            .rfind(|&(_, &first_index)| first_index <= point_index)
             .unwrap();
 
         let statement_index = (point_index - first_index) / 2;