mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
Implement Ranged
on more structs (#6639)
## Summary I noticed some inconsistencies around uses of `.range.start()`, structs that have a `TextRange` field but don't implement `Ranged`, etc. ## Test Plan `cargo test`
This commit is contained in:
parent
a70807e1e1
commit
db1c556508
66 changed files with 221 additions and 176 deletions
|
@ -87,10 +87,8 @@ impl Strategy for StrategyRemoveModuleMember {
|
|||
) -> Result<Box<dyn ExactSizeStringIter + 'a>> {
|
||||
let iter = ast.iter().map(|stmt| {
|
||||
// trim the newlines the range misses
|
||||
input[..stmt.range().start().to_usize()]
|
||||
.trim_end()
|
||||
.to_string()
|
||||
+ input[stmt.range().end().to_usize()..].trim_start()
|
||||
input[..stmt.start().to_usize()].trim_end().to_string()
|
||||
+ input[stmt.end().to_usize()..].trim_start()
|
||||
});
|
||||
Ok(Box::new(iter))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue