Pretty print Diagnostics in snapshot tests (#3906)

This commit is contained in:
Micha Reiser 2023-04-11 11:03:00 +02:00 committed by GitHub
parent 210083bdd8
commit e8aebee3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
901 changed files with 55367 additions and 66782 deletions

View file

@ -167,8 +167,6 @@ enum IndexKind {
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct OneIndexed(NonZeroUsize);
const ONE: NonZeroUsize = unwrap(NonZeroUsize::new(1));
impl OneIndexed {
// SAFETY: These constants are being initialized with non-zero values
/// The smallest value that can be represented by this integer type.
@ -176,6 +174,8 @@ impl OneIndexed {
/// The largest value that can be represented by this integer type
pub const MAX: Self = unwrap(Self::new(usize::MAX));
pub const ONE: NonZeroUsize = unwrap(NonZeroUsize::new(1));
/// Creates a non-zero if the given value is not zero.
pub const fn new(value: usize) -> Option<Self> {
match NonZeroUsize::new(value) {
@ -186,7 +186,7 @@ impl OneIndexed {
/// Construct a new [`OneIndexed`] from a zero-indexed value
pub const fn from_zero_indexed(value: usize) -> Self {
Self(ONE.saturating_add(value))
Self(Self::ONE.saturating_add(value))
}
/// Returns the value as a primitive type.