mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
[red-knot] Report line numbers in mdtest relative to the markdown file, not the test snippet (#13804)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com> Co-authored-by: Micha Reiser <micha@reiser.io> Co-authored-by: Carl Meyer <carl@oddbird.net>
This commit is contained in:
parent
9d102799f9
commit
cd6c937194
4 changed files with 130 additions and 53 deletions
|
@ -394,6 +394,18 @@ impl OneIndexed {
|
|||
None => Self::MIN,
|
||||
}
|
||||
}
|
||||
|
||||
/// Checked addition. Returns `None` if overflow occurred.
|
||||
#[must_use]
|
||||
pub fn checked_add(self, rhs: Self) -> Option<Self> {
|
||||
self.0.checked_add(rhs.0.get()).map(Self)
|
||||
}
|
||||
|
||||
/// Checked subtraction. Returns `None` if overflow occurred.
|
||||
#[must_use]
|
||||
pub fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
self.0.get().checked_sub(rhs.get()).and_then(Self::new)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for OneIndexed {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue