remove trailing punctuation in errors

This commit is contained in:
AF 2023-07-09 15:51:59 +00:00
parent 7d82983ce5
commit ed57b30d5d
11 changed files with 20 additions and 20 deletions

View File

@ -143,9 +143,9 @@ pub enum HeightError {
impl Display for HeightError { impl Display for HeightError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::NodeHeight => write!(f, "invalid node height: 0."), Self::NodeHeight => write!(f, "invalid node height: 0"),
Self::LeafHeight(height) => { Self::LeafHeight(height) => {
write!(f, "invalid leaf height: {height}!=0.") write!(f, "invalid leaf height: {height}!=0")
} }
} }
} }

View File

@ -48,11 +48,11 @@ pub enum BalancingError {
impl Display for BalancingError { impl Display for BalancingError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Height(height_error) => write!(f, "invalid height: {height_error}."), Self::Height(height_error) => write!(f, "invalid height: {height_error}"),
Self::Balance(hl, hr) => write!(f, "unbalanced node: {hl} {hr}."), Self::Balance(hl, hr) => write!(f, "unbalanced node: {hl} {hr}"),
Self::HeightOverflow => write!(f, "tree height overflow."), Self::HeightOverflow => write!(f, "tree height overflow"),
Self::HeightMismatch { children, parent } => { Self::HeightMismatch { children, parent } => {
write!(f, "child-parent height mismatch: {children:?}, {parent}.") write!(f, "child-parent height mismatch: {children:?}, {parent}")
} }
} }
} }

View File

@ -163,7 +163,7 @@ impl<'a, A: 'a + Ord + Clone> BinaryTreesUnbalanced<'a> for Trees<A> {
} }
fn balancing_error<T: 'a>(&self, _error: BalancingError) -> BTWrap<'a, Self, T> { fn balancing_error<T: 'a>(&self, _error: BalancingError) -> BTWrap<'a, Self, T> {
panic!("balancing error.") panic!("balancing error")
} }
fn node_heights(&self, node: &Self::Node) -> (u64, u64) { fn node_heights(&self, node: &Self::Node) -> (u64, u64) {
@ -173,7 +173,7 @@ impl<'a, A: 'a + Ord + Clone> BinaryTreesUnbalanced<'a> for Trees<A> {
impl<'a, A: 'a + Ord + Clone> BinaryTreesBindable<'a> for Trees<A> { impl<'a, A: 'a + Ord + Clone> BinaryTreesBindable<'a> for Trees<A> {
fn bounds_error<T: 'a>(&self, _error: bounds::BoundsError<Self::Key>) -> BTWrap<'a, Self, T> { fn bounds_error<T: 'a>(&self, _error: bounds::BoundsError<Self::Key>) -> BTWrap<'a, Self, T> {
panic!("bounds violated."); panic!("bounds violated");
} }
} }

View File

@ -27,7 +27,7 @@ pub trait InliningExt<E>: Inlining {
) -> Result<([u8; N], Self), E> { ) -> Result<([u8; N], Self), E> {
self.iread_n( self.iread_n(
N, N,
|slice| slice.try_into().expect("`iread_n` wrong length."), |slice| slice.try_into().expect("`iread_n` wrong length"),
err, err,
) )
} }

View File

@ -17,10 +17,10 @@ pub enum ArrayParseError {
impl Display for ArrayParseError { impl Display for ArrayParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Eof => write!(f, "encountered EOF write parsing an array."), Self::Eof => write!(f, "encountered EOF write parsing an array"),
Self::ExtraData(length) => write!( Self::ExtraData(length) => write!(
f, f,
"encountered extra data of length {length} while parsing an array.", "encountered extra data of length {length} while parsing an array",
), ),
} }
} }

View File

@ -17,10 +17,10 @@ pub enum IntParseError {
impl Display for IntParseError { impl Display for IntParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Eof => write!(f, "encountered EOF write parsing an integer."), Self::Eof => write!(f, "encountered EOF write parsing an integer"),
Self::ExtraData(length) => write!( Self::ExtraData(length) => write!(
f, f,
"encountered extra data of length {length} while parsing an integer.", "encountered extra data of length {length} while parsing an integer",
), ),
} }
} }

View File

@ -22,12 +22,12 @@ impl Display for BooleanParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::OutOfBounds(value) => { Self::OutOfBounds(value) => {
write!(f, "boolean value out of bounds: {}.", value) write!(f, "boolean value out of bounds: {}", value)
} }
Self::Eof => write!(f, "encountered EOF write parsing a boolean."), Self::Eof => write!(f, "encountered EOF write parsing a boolean"),
Self::ExtraData(length) => write!( Self::ExtraData(length) => write!(
f, f,
"encountered extra data of length {length} while parsing a boolean.", "encountered extra data of length {length} while parsing a boolean",
), ),
} }
} }

View File

@ -118,7 +118,7 @@ impl Display for SizeError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!( write!(
f, f,
"expected {} bytes, read/wrote {} instead.", "expected {} bytes, read/wrote {} instead",
self.expected, self.received self.expected, self.received
) )
} }

View File

@ -48,7 +48,7 @@ impl Display for PointParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::WrongLength(length) => { Self::WrongLength(length) => {
write!(f, "expected {} bytes, received {}.", HASH_SIZE, length) write!(f, "expected {} bytes, received {}", HASH_SIZE, length)
} }
} }
} }

View File

@ -35,7 +35,7 @@ impl<'a, Ctx: Context<'a>> Resolver<'a, Ctx> for SingularResolver<'a, Ctx> {
fn resolve(self: Rc<Self>, address: Address) -> HashResolution<'a, Ctx> { fn resolve(self: Rc<Self>, address: Address) -> HashResolution<'a, Ctx> {
let point = self.points.get(address.index).unwrap_or_else(|| { let point = self.points.get(address.index).unwrap_or_else(|| {
panic!( panic!(
"singularity out-of-bounds: {}/{}.", "singularity out-of-bounds: {}/{}",
address.index, address.index,
self.points.len() self.points.len()
) )

View File

@ -56,7 +56,7 @@ impl<'a> Display for TestLookupError<'a> {
write!(f, "cast failure: {}", cast_error) write!(f, "cast failure: {}", cast_error)
} }
Self::EmptyResolverAccess(address) => { Self::EmptyResolverAccess(address) => {
write!(f, "accessed an empty resolved at address {}.", address) write!(f, "accessed an empty resolved at address {}", address)
} }
} }
} }