Address review comments
This commit is contained in:
parent
e10b165775
commit
8c5e89907c
3 changed files with 4 additions and 12 deletions
|
@ -266,8 +266,7 @@ pub struct IntRange {
|
|||
|
||||
impl IntRange {
|
||||
/// Best effort; will not know that e.g. `255u8..` is a singleton.
|
||||
#[cfg_attr(not(feature = "rustc"), allow(dead_code))]
|
||||
pub(crate) fn is_singleton(&self) -> bool {
|
||||
pub fn is_singleton(&self) -> bool {
|
||||
// Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite
|
||||
// to infinite, this correctly only detects ranges that contain exacly one `Finite(x)`.
|
||||
self.lo.plus_one() == self.hi
|
||||
|
|
|
@ -79,12 +79,8 @@ pub struct MatchArm<'p, Cx: MatchCx> {
|
|||
|
||||
impl<'p, Cx: MatchCx> Copy for MatchArm<'p, Cx> {}
|
||||
|
||||
#[cfg(not(feature = "rustc"))]
|
||||
pub trait Captures<'a> {}
|
||||
#[cfg(not(feature = "rustc"))]
|
||||
impl<'a, T: ?Sized> Captures<'a> for T {}
|
||||
#[cfg(feature = "rustc")]
|
||||
pub use rustc_data_structures::captures::Captures;
|
||||
|
||||
/// The entrypoint for this crate. Computes whether a match is exhaustive and which of its arms are
|
||||
/// useful, and runs some lints.
|
||||
|
|
|
@ -82,14 +82,11 @@ impl<'a, 'p, 'tcx> PatternColumn<'a, 'p, 'tcx> {
|
|||
/// This returns one column per field of the constructor. They usually all have the same length
|
||||
/// (the number of patterns in `self` that matched `ctor`), except that we expand or-patterns
|
||||
/// which may change the lengths.
|
||||
fn specialize<'b>(
|
||||
fn specialize(
|
||||
&self,
|
||||
pcx: &'b PatCtxt<'_, 'p, 'tcx>,
|
||||
pcx: &PatCtxt<'a, 'p, 'tcx>,
|
||||
ctor: &Constructor<'p, 'tcx>,
|
||||
) -> Vec<PatternColumn<'b, 'p, 'tcx>>
|
||||
where
|
||||
'a: 'b,
|
||||
{
|
||||
) -> Vec<PatternColumn<'a, 'p, 'tcx>> {
|
||||
let arity = ctor.arity(pcx);
|
||||
if arity == 0 {
|
||||
return Vec::new();
|
||||
|
|
Loading…
Add table
Reference in a new issue