Rollup merge of #137712 - meithecatte:extract-binding-mode, r=oli-obk
Clean up TypeckResults::extract_binding_mode - Remove the `Option` from the result type, as `None` is never returned. - Document the difference from the `BindingMode` in `PatKind::Binding`.
This commit is contained in:
commit
a9f3f02ed7
5 changed files with 45 additions and 45 deletions
|
@ -394,8 +394,10 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
matches!(self.type_dependent_defs().get(expr.hir_id), Some(Ok((DefKind::AssocFn, _))))
|
||||
}
|
||||
|
||||
pub fn extract_binding_mode(&self, s: &Session, id: HirId, sp: Span) -> Option<BindingMode> {
|
||||
self.pat_binding_modes().get(id).copied().or_else(|| {
|
||||
/// Returns the computed binding mode for a `PatKind::Binding` pattern
|
||||
/// (after match ergonomics adjustments).
|
||||
pub fn extract_binding_mode(&self, s: &Session, id: HirId, sp: Span) -> BindingMode {
|
||||
self.pat_binding_modes().get(id).copied().unwrap_or_else(|| {
|
||||
s.dcx().span_bug(sp, "missing binding mode");
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue