mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Pretty print Diagnostic
s in snapshot tests (#3906)
This commit is contained in:
parent
210083bdd8
commit
e8aebee3f6
901 changed files with 55367 additions and 66782 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue