diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/never.rs | 21 | ||||
-rw-r--r-- | src/reader.rs | 4 |
3 files changed, 2 insertions, 25 deletions
@@ -7,7 +7,6 @@ mod emitter; mod entities; mod error; mod machine; -mod never; mod reader; pub mod spans; mod tokenizer; @@ -18,6 +17,5 @@ pub use utils::State as InternalState; pub use emitter::{Attribute, DefaultEmitter, Doctype, Emitter, EndTag, StartTag, Token}; pub use error::Error; -pub use never::Never; pub use reader::{BufReadReader, IntoReader, Reader, StringReader}; pub use tokenizer::{State, Tokenizer}; diff --git a/src/never.rs b/src/never.rs deleted file mode 100644 index 85a1243..0000000 --- a/src/never.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::error; -use std::fmt; - -/// Definition of an empty enum. -/// -/// This is used as the error type in situations where there can't be an error. A `Result<T, Never>` -/// can be safely unwrapped and the `unwrap()` may be optimized away entirely. -pub enum Never {} - -impl fmt::Display for Never { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - match *self {} - } -} -impl fmt::Debug for Never { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - match *self {} - } -} - -impl error::Error for Never {} diff --git a/src/reader.rs b/src/reader.rs index 0e7a3a4..1acb4a3 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1,4 +1,4 @@ -use crate::Never; +use std::convert::Infallible; use std::io::{self, BufRead, BufReader, Read}; /// An object that provides characters to the tokenizer. @@ -67,7 +67,7 @@ impl<'a> StringReader<'a> { } impl<'a> Reader for StringReader<'a> { - type Error = Never; + type Error = Infallible; fn read_char(&mut self) -> Result<Option<char>, Self::Error> { let c = match self.cursor.next() { |