diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-01-31 01:29:21 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-01-31 01:32:05 +0100 |
| commit | 40402cbadad4f7df9ab7e2f3089a5b038d19f586 (patch) | |
| tree | 9730a117432362babcc19e8d10ff85cc08474239 /compiler/rustc_pattern_analysis/src/constructor.rs | |
| parent | 15b473451cce5237ccff6cad85836ecf203475e8 (diff) | |
| download | rust-40402cbadad4f7df9ab7e2f3089a5b038d19f586.tar.gz rust-40402cbadad4f7df9ab7e2f3089a5b038d19f586.zip | |
Manual `Debug` impls are not needed since `TypeCx: Debug`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/constructor.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/constructor.rs | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 3211d6a4cfe..8fc826f403e 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -648,6 +648,7 @@ impl OpaqueId { /// `specialize_constructor` returns the list of fields corresponding to a pattern, given a /// constructor. `Constructor::apply` reconstructs the pattern from a pair of `Constructor` and /// `Fields`. +#[derive(Debug)] pub enum Constructor<Cx: TypeCx> { /// Tuples and structs. Struct, @@ -717,33 +718,6 @@ impl<Cx: TypeCx> Clone for Constructor<Cx> { } } -impl<Cx: TypeCx> fmt::Debug for Constructor<Cx> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Constructor::Struct => f.debug_tuple("Struct").finish(), - Constructor::Variant(idx) => f.debug_tuple("Variant").field(idx).finish(), - Constructor::Ref => f.debug_tuple("Ref").finish(), - Constructor::Slice(slice) => f.debug_tuple("Slice").field(slice).finish(), - Constructor::UnionField => f.debug_tuple("UnionField").finish(), - Constructor::Bool(b) => f.debug_tuple("Bool").field(b).finish(), - Constructor::IntRange(range) => f.debug_tuple("IntRange").field(range).finish(), - Constructor::F32Range(lo, hi, end) => { - f.debug_tuple("F32Range").field(lo).field(hi).field(end).finish() - } - Constructor::F64Range(lo, hi, end) => { - f.debug_tuple("F64Range").field(lo).field(hi).field(end).finish() - } - Constructor::Str(value) => f.debug_tuple("Str").field(value).finish(), - Constructor::Opaque(inner) => f.debug_tuple("Opaque").field(inner).finish(), - Constructor::Or => f.debug_tuple("Or").finish(), - Constructor::Wildcard => f.debug_tuple("Wildcard").finish(), - Constructor::NonExhaustive => f.debug_tuple("NonExhaustive").finish(), - Constructor::Hidden => f.debug_tuple("Hidden").finish(), - Constructor::Missing => f.debug_tuple("Missing").finish(), - } - } -} - impl<Cx: TypeCx> Constructor<Cx> { pub(crate) fn is_non_exhaustive(&self) -> bool { matches!(self, NonExhaustive) |
