From 060cc37f3225dd69b5d0df089eec52ff92953b01 Mon Sep 17 00:00:00 2001 From: dianne Date: Wed, 5 Feb 2025 09:09:42 -0800 Subject: [PATCH] peace of mind: remove a call to `Option::expect` --- compiler/rustc_mir_build/src/thir/pattern/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index f72ce2fe6fb..d4a3d1516c8 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -59,8 +59,9 @@ pub(super) fn pat_from_hir<'a, 'tcx>( }; let result = pcx.lower_pattern(pat); debug!("pat_from_hir({:?}) = {:?}", pat, result); - if let Some(info) = migration_info { - let sugg = pcx.rust_2024_migration_suggestion.expect("suggestion should be present"); + if let Some(info) = migration_info + && let Some(sugg) = pcx.rust_2024_migration_suggestion + { let mut spans = MultiSpan::from_spans(info.primary_labels.iter().map(|(span, _)| *span).collect()); for (span, label) in &info.primary_labels {