mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
Use consistent re-export from ruff_source_file
(#9320)
Right now, we both re-export (via `pub use`) and mark the modules themselves a `pub`, so they can be imported through two different paths.
This commit is contained in:
parent
c01bb0d485
commit
eb9a1bc5f1
4 changed files with 12 additions and 10 deletions
|
@ -336,10 +336,10 @@ pub fn add_noqa_to_path(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Log any parse errors.
|
// Log any parse errors.
|
||||||
if let Some(err) = error {
|
if let Some(error) = error {
|
||||||
error!(
|
error!(
|
||||||
"{}",
|
"{}",
|
||||||
DisplayParseError::new(err, locator.to_source_code(), source_kind)
|
DisplayParseError::new(error, locator.to_source_code(), source_kind)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use ruff_python_trivia::{indentation_at_offset, is_python_whitespace, PythonWhitespace};
|
use ruff_python_trivia::{indentation_at_offset, is_python_whitespace, PythonWhitespace};
|
||||||
use ruff_source_file::{newlines::UniversalNewlineIterator, Locator};
|
use ruff_source_file::{Locator, UniversalNewlineIterator};
|
||||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||||
|
|
||||||
use crate::Stmt;
|
use crate::Stmt;
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
|
use ruff_source_file::UniversalNewlines;
|
||||||
|
|
||||||
use crate::PythonWhitespace;
|
use crate::PythonWhitespace;
|
||||||
use ruff_source_file::newlines::UniversalNewlines;
|
|
||||||
|
|
||||||
/// Indent each line by the given prefix.
|
/// Indent each line by the given prefix.
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,21 +2,22 @@ use std::cmp::Ordering;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod line_index;
|
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||||
mod locator;
|
|
||||||
pub mod newlines;
|
|
||||||
|
|
||||||
pub use crate::line_index::{LineIndex, OneIndexed};
|
pub use crate::line_index::{LineIndex, OneIndexed};
|
||||||
pub use locator::Locator;
|
pub use crate::locator::Locator;
|
||||||
pub use newlines::{
|
pub use crate::newlines::{
|
||||||
find_newline, Line, LineEnding, NewlineWithTrailingNewline, UniversalNewlineIterator,
|
find_newline, Line, LineEnding, NewlineWithTrailingNewline, UniversalNewlineIterator,
|
||||||
UniversalNewlines,
|
UniversalNewlines,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod line_index;
|
||||||
|
mod locator;
|
||||||
|
mod newlines;
|
||||||
|
|
||||||
/// Gives access to the source code of a file and allows mapping between [`TextSize`] and [`SourceLocation`].
|
/// Gives access to the source code of a file and allows mapping between [`TextSize`] and [`SourceLocation`].
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SourceCode<'src, 'index> {
|
pub struct SourceCode<'src, 'index> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue