mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
Use lazy initialization for SourceCodeLocator (#472)
This commit is contained in:
parent
2679db1d10
commit
4beea0484a
19 changed files with 112 additions and 94 deletions
|
@ -25,9 +25,9 @@ pub fn leading_space(line: &str) -> String {
|
|||
}
|
||||
|
||||
/// Extract the leading indentation from a docstring.
|
||||
pub fn indentation<'a>(checker: &'a mut Checker, docstring: &Expr) -> &'a str {
|
||||
pub fn indentation<'a>(checker: &'a Checker, docstring: &Expr) -> &'a str {
|
||||
let range = Range::from_located(docstring);
|
||||
checker.locator.slice_source_code_range(&Range {
|
||||
checker.get_locator().slice_source_code_range(&Range {
|
||||
location: Location::new(range.location.row(), 1),
|
||||
end_location: Location::new(range.location.row(), range.location.column()),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue