Prefer a two value enum over bool
This commit is contained in:
parent
30f168ef81
commit
4f2b108816
9 changed files with 19 additions and 23 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
// Prefer importing stable_mir over internal rustc constructs to make this file more readable.
|
||||
|
||||
use rustc_hir::RangeEnd;
|
||||
use rustc_middle::ty::{self as rustc_ty, Const as InternalConst, Ty as InternalTy, TyCtxt};
|
||||
use rustc_span::Symbol;
|
||||
use stable_mir::abi::Layout;
|
||||
|
@ -91,7 +92,7 @@ impl RustcInternal for Pattern {
|
|||
Pattern::Range { start, end, include_end } => rustc_ty::PatternKind::Range {
|
||||
start: start.as_ref().map(|c| c.internal(tables, tcx)),
|
||||
end: end.as_ref().map(|c| c.internal(tables, tcx)),
|
||||
include_end: *include_end,
|
||||
include_end: if *include_end { RangeEnd::Included } else { RangeEnd::Excluded },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> {
|
|||
ty::PatternKind::Range { start, end, include_end } => stable_mir::ty::Pattern::Range {
|
||||
start: start.stable(tables),
|
||||
end: end.stable(tables),
|
||||
include_end,
|
||||
include_end: matches!(include_end, rustc_hir::RangeEnd::Included),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue