mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Remove PatKind::Never
This commit is contained in:
parent
ec1483bf2e
commit
bfe88a3bd0
@ -904,7 +904,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
|
|||||||
print::write_slice_like(&mut s, &prefix, has_dot_dot, &suffix).unwrap();
|
print::write_slice_like(&mut s, &prefix, has_dot_dot, &suffix).unwrap();
|
||||||
PatKind::Print(s)
|
PatKind::Print(s)
|
||||||
}
|
}
|
||||||
Never if self.tcx.features().never_patterns => PatKind::Never,
|
Never if self.tcx.features().never_patterns => PatKind::Print("!".to_string()),
|
||||||
Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => {
|
Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => {
|
||||||
PatKind::Print("_".to_string())
|
PatKind::Print("_".to_string())
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,12 @@ pub(crate) struct Pat<'tcx> {
|
|||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) enum PatKind {
|
pub(crate) enum PatKind {
|
||||||
Never,
|
|
||||||
|
|
||||||
Print(String),
|
Print(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> fmt::Display for Pat<'tcx> {
|
impl<'tcx> fmt::Display for Pat<'tcx> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
PatKind::Never => write!(f, "!"),
|
|
||||||
PatKind::Print(ref string) => write!(f, "{string}"),
|
PatKind::Print(ref string) => write!(f, "{string}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user