diff options
| author | dianne <diannes.gm@gmail.com> | 2025-02-05 09:09:42 -0800 |
|---|---|---|
| committer | dianne <diannes.gm@gmail.com> | 2025-02-05 09:09:42 -0800 |
| commit | 060cc37f3225dd69b5d0df089eec52ff92953b01 (patch) | |
| tree | 33ac24162dcfd46602b71e17e9aacb0c1d0a94d6 | |
| parent | a5cc4cbe64876c339cc1fb47fb962792bc142146 (diff) | |
| download | rust-060cc37f3225dd69b5d0df089eec52ff92953b01.tar.gz rust-060cc37f3225dd69b5d0df089eec52ff92953b01.zip | |
peace of mind: remove a call to `Option::expect`
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/mod.rs | 5 |
1 files 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 { |
