Skip to content

Commit

Permalink
refactor: remove unused error
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloso committed Nov 2, 2023
1 parent 78c1e90 commit 81d357d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions pomsky-lib/src/diagnose/compile_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ pub(crate) enum CompileErrorKind {
similar: Option<Box<str>>,
},
NameUsedMultipleTimes(String),
EmptyClass,
EmptyClassNegated {
group1: RegexCharSetItem,
group2: RegexCharSetItem,
Expand Down Expand Up @@ -134,9 +133,6 @@ impl core::fmt::Display for CompileErrorKind {
CompileErrorKind::NameUsedMultipleTimes(name) => {
write!(f, "Group name `{name}` used multiple times")
}
CompileErrorKind::EmptyClass => {
write!(f, "This character class is empty")
}
CompileErrorKind::EmptyClassNegated { .. } => {
write!(f, "This negated character class matches nothing")
}
Expand Down
1 change: 0 additions & 1 deletion pomsky-lib/src/diagnose/diagnostic_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ impl<'a> From<&'a CompileErrorKind> for DiagnosticCode {
C::HugeReference => Self::HugeReference,
C::UnknownReferenceNumber(_) | C::UnknownReferenceName { .. } => Self::UnknownReference,
C::NameUsedMultipleTimes(_) => Self::NameUsedMultipleTimes,
C::EmptyClass => Self::EmptyClass,
C::EmptyClassNegated { .. } => Self::EmptyClassNegated,
C::CaptureInLet => Self::CaptureInLet,
C::ReferenceInLet => Self::ReferenceInLet,
Expand Down
4 changes: 1 addition & 3 deletions pomsky-lib/src/diagnose/diagnostic_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ impl From<&CompileErrorKind> for DiagnosticKind {
| K::NegatedHorizVertSpace
| K::RelativeRefZero
| K::DotNetNumberedRefWithMixedGroups => DiagnosticKind::Resolve,
K::EmptyClass | K::EmptyClassNegated { .. } | K::IllegalNegation { .. } => {
DiagnosticKind::Invalid
}
K::EmptyClassNegated { .. } | K::IllegalNegation { .. } => DiagnosticKind::Invalid,
K::CaptureInLet
| K::ReferenceInLet
| K::RecursiveVariable
Expand Down
5 changes: 0 additions & 5 deletions pomsky-lib/src/exprs/char_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ impl<'i> RuleExt<'i> for CharClass {
options: CompileOptions,
state: &mut CompileState<'_, 'i>,
) -> CompileResult<'i> {
if self.inner.is_empty() {
// TODO: Check if this is still needed since an empty class is a syntactic error
return Err(CompileErrorKind::EmptyClass.at(self.span));
}

let mut prev_items: HashSet<GroupItem> = HashSet::new();

let mut negative = false;
Expand Down

0 comments on commit 81d357d

Please sign in to comment.