diff --git a/crates/ruff_text_size/src/range.rs b/crates/ruff_text_size/src/range.rs index 895cfea530..302568e8e3 100644 --- a/crates/ruff_text_size/src/range.rs +++ b/crates/ruff_text_size/src/range.rs @@ -425,6 +425,22 @@ impl TextRange { } } +/// Conversion methods. +impl TextRange { + /// A convenience routine for converting this range to a + /// standard library range that satisfies the `RangeBounds` + /// trait. + /// + /// This is also available as a `From` trait implementation, + /// but this method avoids the need to specify types to help + /// inference. + #[inline] + #[must_use] + pub fn to_std_range(&self) -> Range { + (*self).into() + } +} + impl Index for str { type Output = str; #[inline]