Add case alternatives for switch.

This commit is contained in:
Stephen Chung
2022-07-04 17:42:24 +08:00
parent 54db9a2819
commit dee66a409f
9 changed files with 334 additions and 170 deletions

View File

@@ -283,7 +283,7 @@ impl AddAssign for Position {
/// _(internals)_ A span consisting of a starting and an ending [positions][Position].
/// Exported under the `internals` feature only.
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, Default)]
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub struct Span {
/// Starting [position][Position].
start: Position,
@@ -291,6 +291,12 @@ pub struct Span {
end: Position,
}
impl Default for Span {
fn default() -> Self {
Self::NONE
}
}
impl Span {
/// Empty [`Span`].
pub const NONE: Self = Self::new(Position::NONE, Position::NONE);