From d0f5b5caa865445bef2f59d1dd0f339a0750434f Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Thu, 16 Apr 2026 15:19:42 +0300 Subject: [PATCH] Replace redundant unwrap with get_or_insert_with --- compiler/rustc_middle/src/query/job.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_middle/src/query/job.rs b/compiler/rustc_middle/src/query/job.rs index 24c4daf9855d2..8c78bf24287e0 100644 --- a/compiler/rustc_middle/src/query/job.rs +++ b/compiler/rustc_middle/src/query/job.rs @@ -36,10 +36,7 @@ impl<'tcx> QueryJob<'tcx> { } pub fn latch(&mut self) -> QueryLatch<'tcx> { - if self.latch.is_none() { - self.latch = Some(QueryLatch::new()); - } - self.latch.as_ref().unwrap().clone() + self.latch.get_or_insert_with(QueryLatch::new).clone() } /// Signals to waiters that the query is complete.