Remove comment lexing from isort (#6794)

## Summary

No need to lex to find comments -- we already know their locations via
`Indexer`.
This commit is contained in:
Charlie Marsh 2023-08-22 17:26:38 -04:00 committed by GitHub
parent e1f4438498
commit 42ff833d00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 30 deletions

View file

@ -99,18 +99,6 @@ impl Indexer {
&self.comment_ranges
}
/// Returns the comments in the given range as source code slices
pub fn comments_in_range<'a>(
&'a self,
range: TextRange,
locator: &'a Locator,
) -> impl Iterator<Item = &'a str> {
self.comment_ranges
.comments_in_range(range)
.iter()
.map(move |comment_range| locator.slice(*comment_range))
}
/// Returns the line start positions of continuations (backslash).
pub fn continuation_line_starts(&self) -> &[TextSize] {
&self.continuation_lines