mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
Re-integrate RustPython parser repository (#4359)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
865205d992
commit
be6e00ef6e
270 changed files with 3061 additions and 3361 deletions
|
@ -1,10 +1,10 @@
|
|||
use ruff_text_size::TextRange;
|
||||
use rustpython_parser::ast::Located;
|
||||
use rustpython_parser::ast::Attributed;
|
||||
|
||||
use crate::source_code::Locator;
|
||||
|
||||
/// Extract the leading indentation from a line.
|
||||
pub fn indentation<'a, T>(locator: &'a Locator, located: &Located<T>) -> Option<&'a str> {
|
||||
pub fn indentation<'a, T>(locator: &'a Locator, located: &Attributed<T>) -> Option<&'a str> {
|
||||
let line_start = locator.line_start(located.start());
|
||||
let indentation = &locator.contents()[TextRange::new(line_start, located.start())];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue