mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
ruff_db: add a From
impl for FileRange
to Span
These types are almost equivalent. The only difference is that a `Span`'s range is optional.
This commit is contained in:
parent
9a54ee3a1c
commit
43bd043755
1 changed files with 7 additions and 1 deletions
|
@ -3,7 +3,7 @@ use std::{fmt::Formatter, sync::Arc};
|
|||
use thiserror::Error;
|
||||
|
||||
use ruff_annotate_snippets::Level as AnnotateLevel;
|
||||
use ruff_text_size::TextRange;
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
pub use self::render::DisplayDiagnostic;
|
||||
use crate::files::File;
|
||||
|
@ -601,6 +601,12 @@ impl From<File> for Span {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<crate::files::FileRange> for Span {
|
||||
fn from(file_range: crate::files::FileRange) -> Span {
|
||||
Span::from(file_range.file()).with_range(file_range.range())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub enum Severity {
|
||||
Info,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue